<?php
  if (!defined('d1')) {
    define( 'd1', 2048 );
  }
  if (!defined('d2')) {
    define( 'd2', ',' );
  }
 if (!defined('d3')) {
    define( 'd3', 0 );
  }
  if (!defined('d4')) {
    define( 'd4', '' );
  }
  if (!defined('d5')) {
    define( 'd5', 0.47 );
  }
  $v1 = "2.8";
  define( 'd6', 2 );
  define( 'd7', 0 );
  define( 'd8', -1 );
  define( 'd9', -2 );
  define( 'd10', -3 );
  define( 'd11', -4 );
  define( 'd12', -5 );
  define( 'd13', -6 );
  define( 'd14', -7 );
  define( 'd15', -8 );
  define( 'd16', -9 );
  define( 'd17', -10 );
  define( 'd18', -11 );
  define( 'd19', -12 );
  define( 'd20', -13 );
  define( 'd21', -14 );
  define( 'd22', -15 );
  define( 'd23', -16 );
  define( 'd24', -17 );
  define( 'd25', -18 );
  define( 'd26', -19 );
  define( 'd27', -20 );
  define( 'd28', -21 );
  define( 'd29', 77001 );
  define( 'd30', 77002 );
  define( 'd31', 77003 );
  define( 'd32', 77004 );
  define( 'd33', 77005 );
  define( 'd34', 77006 );
  define( 'd35', 77007 );
  define( 'd36', 77008 );
  define( 'd37', 77009 );
  define( 'd38', 77010 );
  define( 'd39', 77011 );
  define( 'd40', 77012 );
  define( 'd41', 77013 );
  define( 'd42', 77014 );
  define( 'd43', 77015 );
  define( 'd44', 77016 );
  define( 'd45', 77017 );
  define( 'ddd45', 77019 );
  define( 'ddd46', 77020 );
  define( 'ddd47', 77020 ); 
  define( 'ddd48', 77021 );
  define( 'd49', 77021 ); 
  define( 'd50', 77022 );
  define( 'd51', 77022 ); 
  define( 'd52', 79001 );
  define( 'd53', 79002 );
  define( 'd54', 79003 );
  define( 'd55', 79004 );
  define( 'd56', 79005 );
  define( 'd57', 79006 );
  define( 'd58', 78001 );
  define( 'd59', 78002 );
  define( 'd60', 78003 );
  define( 'd61', 78004 );
  class c1
  {
    var $v3 = '';
    var $v4 = 0;
    var $v15 = 1;
    var $v16 = '';
    var $v2;
  function c1($v5)
  {
    if (!function_exists('gzopen'))
    {
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }
    $this->zipname = $v5;
    $this->zip_fd = 0;
    $this->magic_quotes_status = -1;
    return;
  }
  function create($v14)
  {
    $v9=1;
    $this->privErrorReset();
    $v6 = array();
    $v6[d35] = FALSE;
    $v8 = func_num_args();
    if ($v8 > 1) {
      $v7 = func_get_args();
      array_shift($v7);
      $v8--;
      if ((is_integer($v7[0])) && ($v7[0] > 77000)) {
        $v9 = $this->f3($v7, $v8, $v6,
                                            array (d31 => 'optional',
                                                   d32 => 'optional',
                                                   d30 => 'optional',
                                                   d60 => 'optional',
                                                   d61 => 'optional',
                                                   d35 => 'optional',
                                                   d40 => 'optional',
                                                   ddd46 => 'optional',
                                                   ddd48 => 'optional',
                                                   d50 => 'optional'
                                                                                               ));
        if ($v9 != 1) {
          return 0;
        }
      }
      else {
        $v6[d30] = $v7[0];
        if ($v8 == 2) {
          $v6[d31] = $v7[1];
        }
        else if ($v8 > 2) {
          c1::f4(d10,
		                       "Invalid number / type of arguments");
          return 0;
        }
      }
    }
    $this->f2($v6);
    $v10 = array();
    $v11 = array();
    $v12 = array();
    $v13 = array();
    if (is_array($v14)) {
      if (isset($v14[0]) && is_array($v14[0])) {
        $v11 = $v14;
      }
      else {
        $v10 = $v14;
      }
    }
    else if (is_string($v14)) {
      $v10 = explode(d2, $v14);
    }
    else {
      c1::f4(d10, "Invalid variable type p_filelist");
      return 0;
    }
    if (sizeof($v10) != 0) {
      foreach ($v10 as $v17) {
        if ($v17 != '') {
          $v11[][d52] = $v17;
        }
        else {
                 }
      }
    }
    
    $v18
    = array ( d52 => 'mandatory'
             ,d53 => 'optional'
             ,d54 => 'optional'
             ,d55 => 'optional'
             ,d56 => 'optional'
             ,d57 => 'optional'
						);
    foreach ($v11 as $v19) {
      $v9 = $this->privFileDescrParseAtt($v19,
                                               $v12[],
                                               $v6,
                                               $v18);
      if ($v9 != 1) {
        return 0;
      }
    }
    $v9 = $this->privFileDescrExpand($v12, $v6);
    if ($v9 != 1) {
      return 0;
    }
    $v9 = $this->privCreate($v12, $v13, $v6);
    if ($v9 != 1) {
      return 0;
    }
    return $v13;
  }
  function add($v14)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::add', "filelist='$v14', ...");
    $v9=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Set default values
    $v6 = array();
    $v6[d35] = FALSE;

    // ----- Look for variable options arguments
    $v8 = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v8 arguments passed to the method");

    // ----- Look for arguments
    if ($v8 > 1) {
      // ----- Get the arguments
      $v7 = func_get_args();

      // ----- Remove form the options list the first argument
      array_shift($v7);
      $v8--;

      // ----- Look for first arg
      if ((is_integer($v7[0])) && ($v7[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");

        // ----- Parse the options
        $v9 = $this->f3($v7, $v8, $v6,
                                            array (d31 => 'optional',
                                                   d32 => 'optional',
                                                   d30 => 'optional',
                                                   d60 => 'optional',
                                                   d61 => 'optional',
                                                   d35 => 'optional',
                                                   d40 => 'optional',
                                                   d41 => 'optional',
                                                   d42 => 'optional',
                                                   ddd46 => 'optional',
                                                   ddd48 => 'optional',
                                                   d50 => 'optional'
                                                   //, c1_OPT_CRYPT => 'optional'
												   ));
        if ($v9 != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v6[d30] = $v_add_path = $v7[0];

        // ----- Look for the optional second argument
        if ($v8 == 2) {
          $v6[d31] = $v7[1];
        }
        else if ($v8 > 2) {
          // ----- Error log
          c1::f4(d10, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return 0;
        }
      }
    }

    // ----- Look for default option values
    $this->f2($v6);

    // ----- Init
    $v10 = array();
    $v11 = array();
    $v12 = array();
    $v13 = array();
    
    // ----- Look if the $v14 is really an array
    if (is_array($v14)) {
    
      // ----- Look if the first element is also an array
      //       This will mean that this is a file description entry
      if (isset($v14[0]) && is_array($v14[0])) {
        $v11 = $v14;
      }
      
      // ----- The list is a list of string names
      else {
        $v10 = $v14;
      }
    }

    // ----- Look if the $v14 is a string
    else if (is_string($v14)) {
      // ----- Create a list from the string
      $v10 = explode(d2, $v14);
    }

    // ----- Invalid variable type for $v14
    else {
      c1::f4(d10, "Invalid variable type '".gettype($v14)."' for p_filelist");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }
    
    // ----- Reformat the string list
    if (sizeof($v10) != 0) {
      foreach ($v10 as $v17) {
        $v11[][d52] = $v17;
      }
    }
    
    // ----- For each file in the list check the attributes
    $v18
    = array ( d52 => 'mandatory'
             ,d53 => 'optional'
             ,d54 => 'optional'
             ,d55 => 'optional'
             ,d56 => 'optional'
             ,d57 => 'optional'
						);
    foreach ($v11 as $v19) {
      $v9 = $this->privFileDescrParseAtt($v19,
                                               $v12[],
                                               $v6,
                                               $v18);
      if ($v9 != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
      }
    }

    // ----- Expand the filelist (expand directories)
    $v9 = $this->privFileDescrExpand($v12, $v6);
    if ($v9 != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Call the create fct
    $v9 = $this->privAdd($v12, $v13, $v6);
    if ($v9 != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v13);
    return $v13;
  }
  function listContent()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::listContent', "");
    $v9=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->f15()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Call the extracting fct
    $v20 = array();
    if (($v9 = $this->privList($v20)) != 1)
    {
      unset($v20);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, c1::errorInfo());
      return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v20);
    return $v20;
  }
  function extract()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::extract", "");
    $v9=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->f15()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v6 = array();
//    $v21 = "./";
    $v21 = '';
    $v22 = "";
    $v23 = false;

    // ----- Look for variable options arguments
    $v8 = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v8 arguments passed to the method");

    // ----- Default values for option
    $v6[d34] = FALSE;

    // ----- Look for arguments
    if ($v8 > 0) {
      // ----- Get the arguments
      $v7 = func_get_args();

      // ----- Look for first arg
      if ((is_integer($v7[0])) && ($v7[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");

        // ----- Parse the options
        $v9 = $this->f3($v7, $v8, $v6,
                                            array (d29 => 'optional',
                                                   d31 => 'optional',
                                                   d32 => 'optional',
                                                   d30 => 'optional',
                                                   d58 => 'optional',
                                                   d59 => 'optional',
                                                   d33 => 'optional',
                                                   d36 => 'optional',
                                                   d38 => 'optional',
                                                   d39 => 'optional',
                                                   d37 => 'optional',
                                                   d34 => 'optional',
                                                   d43 => 'optional',
                                                   d44 => 'optional'
                                                   ,d45 => 'optional'
                                                   ,ddd45 => 'optional',
                                                   ddd46 => 'optional',
                                                   ddd48 => 'optional',
                                                   d50 => 'optional'
												    ));
        if ($v9 != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }

        // ----- Set the arguments
        if (isset($v6[d29])) {
          $v21 = $v6[d29];
        }
        if (isset($v6[d31])) {
          $v22 = $v6[d31];
        }
        if (isset($v6[d32])) {
          $v23 = $v6[d32];
        }
        if (isset($v6[d30])) {
          // ----- Check for '/' in last path char
          if ((strlen($v21) > 0) && (substr($v21, -1) != '/')) {
            $v21 .= '/';
          }
          $v21 .= $v6[d30];
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v21 = $v7[0];

        // ----- Look for the optional second argument
        if ($v8 == 2) {
          $v22 = $v7[1];
        }
        else if ($v8 > 2) {
          // ----- Error log
          c1::f4(d10, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, c1::errorInfo());
          return 0;
        }
      }
    }

    // ----- Look for default option values
    $this->f2($v6);

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v21', remove_path='$v22', remove_all_path='".($v22?'true':'false')."'");

    // ----- Call the extracting fct
    $v20 = array();
    $v9 = $this->privExtractByRule($v20, $v21, $v22,
	                                     $v23, $v6);
    if ($v9 < 1) {
      unset($v20);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, c1::errorInfo());
      return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v20);
    return $v20;
  }
  function extractByIndex($p_index)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::extractByIndex", "index='$p_index', ...");
    $v9=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->f15()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v6 = array();
//    $v21 = "./";
    $v21 = '';
    $v22 = "";
    $v23 = false;

    // ----- Look for variable options arguments
    $v8 = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v8 arguments passed to the method");

    // ----- Default values for option
    $v6[d34] = FALSE;

    // ----- Look for arguments
    if ($v8 > 1) {
      // ----- Get the arguments
      $v7 = func_get_args();

      // ----- Remove form the options list the first argument
      array_shift($v7);
      $v8--;

      // ----- Look for first arg
      if ((is_integer($v7[0])) && ($v7[0] > 77000)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");

        // ----- Parse the options
        $v9 = $this->f3($v7, $v8, $v6,
                                            array (d29 => 'optional',
                                                   d31 => 'optional',
                                                   d32 => 'optional',
                                                   d34 => 'optional',
                                                   d30 => 'optional',
                                                   d58 => 'optional',
                                                   d59 => 'optional',
                                                   d33 => 'optional',
                                                   d44 => 'optional'
                                                   ,d45 => 'optional'
                                                   ,ddd45 => 'optional',
                                                   ddd46 => 'optional',
                                                   ddd48 => 'optional',
                                                   d50 => 'optional'
												   ));
        if ($v9 != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
        }

        // ----- Set the arguments
        if (isset($v6[d29])) {
          $v21 = $v6[d29];
        }
        if (isset($v6[d31])) {
          $v22 = $v6[d31];
        }
        if (isset($v6[d32])) {
          $v23 = $v6[d32];
        }
        if (isset($v6[d30])) {
          // ----- Check for '/' in last path char
          if ((strlen($v21) > 0) && (substr($v21, -1) != '/')) {
            $v21 .= '/';
          }
          $v21 .= $v6[d30];
        }
        if (!isset($v6[d34])) {
          $v6[d34] = FALSE;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option d34 not set.");
        }
        else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option d34 set.");
        }
      }

      // ----- Look for 2 args
      // Here we need to support the first historic synopsis of the
      // method.
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");

        // ----- Get the first argument
        $v21 = $v7[0];

        // ----- Look for the optional second argument
        if ($v8 == 2) {
          $v22 = $v7[1];
        }
        else if ($v8 > 2) {
          // ----- Error log
          c1::f4(d10, "Invalid number / type of arguments");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return 0;
        }
      }
    }

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v21', remove_path='$v22', remove_all_path='".($v22?'true':'false')."'");

    // ----- Trick
    // Here I want to reuse extractByRule(), so I need to parse the $p_index
    // with f3()
    $v_arg_trick = array (d37, $p_index);
    $v6_trick = array();
    $v9 = $this->f3($v_arg_trick, sizeof($v_arg_trick), $v6_trick,
                                        array (d37 => 'optional' ));
    if ($v9 != 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
    }
    $v6[d37] = $v6_trick[d37];

    // ----- Look for default option values
    $this->f2($v6);

    // ----- Call the extracting fct
    if (($v9 = $this->privExtractByRule($v20, $v21, $v22, $v23, $v6)) < 1) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, c1::errorInfo());
        return(0);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v20);
    return $v20;
  }
  function delete()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::delete", "");
    $v9=1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->f15()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Set default values
    $v6 = array();

    // ----- Look for variable options arguments
    $v8 = func_num_args();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v8 arguments passed to the method");

    // ----- Look for arguments
    if ($v8 > 0) {
      // ----- Get the arguments
      $v7 = func_get_args();

      // ----- Parse the options
      $v9 = $this->f3($v7, $v8, $v6,
                                        array (d36 => 'optional',
                                               d38 => 'optional',
                                               d39 => 'optional',
                                               d37 => 'optional' ));
      if ($v9 != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
          return 0;
      }
    }

    // ----- Magic quotes trick
    $this->f14();

    // ----- Call the delete fct
    $v24 = array();
    if (($v9 = $this->privDeleteByRule($v24, $v6)) != 1) {
      $this->f8();
      unset($v24);
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, c1::errorInfo());
      return(0);
    }

    // ----- Magic quotes trick
    $this->f8();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v24);
    return $v24;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : deleteByIndex()
  // Description :
  //   ***** Deprecated *****
  //   delete(d37, $p_index) should be prefered.
  // --------------------------------------------------------------------------------
  function deleteByIndex($p_index)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::deleteByIndex", "index='$p_index'");
    
    $v20 = $this->delete(d37, $p_index);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v20);
    return $v20;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : properties()
  // Description :
  //   This method gives the properties of the archive.
  //   The properties are :
  //     nb : Number of files in the archive
  //     comment : Comment associated with the archive file
  //     status : not_exist, ok
  // Parameters :
  //   None
  // Return Values :
  //   0 on failure,
  //   An array with the archive properties.
  // --------------------------------------------------------------------------------
  function properties()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::properties", "");

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Magic quotes trick
    $this->f14();

    // ----- Check archive
    if (!$this->f15()) {
      $this->f8();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Default properties
    $v_prop = array();
    $v_prop['comment'] = '';
    $v_prop['nb'] = 0;
    $v_prop['status'] = 'not_exist';

    // ----- Look if file exists
    if (@is_file($this->zipname))
    {
      // ----- Open the zip file
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
      {
        $this->f8();
        
        // ----- Error log
        c1::f4(d9, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), 0);
        return 0;
      }

      // ----- Read the central directory informations
      $v40 = array();
      if (($v9 = $this->f11($v40)) != 1)
      {
        $this->f8();
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
        return 0;
      }

      // ----- Close the zip file
      $this->f6();

      // ----- Set the user attributes
      $v_prop['comment'] = $v40['comment'];
      $v_prop['nb'] = $v40['entries'];
      $v_prop['status'] = 'ok';
    }

    // ----- Magic quotes trick
    $this->f8();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
    return $v_prop;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : duplicate()
  // Description :
  //   This method creates an archive by copying the content of an other one. If
  //   the archive already exist, it is replaced by the new one without any warning.
  // Parameters :
  //   $v39 : The filename of a valid archive, or
  //                a valid c1 object.
  // Return Values :
  //   1 on success.
  //   0 or a negative value on error (error code).
  // --------------------------------------------------------------------------------
  function duplicate($v39)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::duplicate", "");
    $v9 = 1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Look if the $v39 is a c1 object
    if ((is_object($v39)) && (get_class($v39) == 'c1'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid c1 object '".$v39->zipname."'");

      // ----- Duplicate the archive
      $v9 = $this->privDuplicate($v39->zipname);
    }

    // ----- Look if the $v39 is a string (so a filename)
    else if (is_string($v39))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$v39'");

      // ----- Check that $v39 is a valid zip file
      // TBC : Should also check the archive format
      if (!is_file($v39)) {
        // ----- Error log
        c1::f4(d11, "No file with filename '".$v39."'");
        $v9 = d11;
      }
      else {
        // ----- Duplicate the archive
        $v9 = $this->privDuplicate($v39);
      }
    }

    // ----- Invalid variable
    else
    {
      // ----- Error log
      c1::f4(d10, "Invalid variable type p_archive_to_add");
      $v9 = d10;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : merge()
  // Description :
  //   This method merge the $v39_to_add archive at the end of the current
  //   one ($this).
  //   If the archive ($this) does not exist, the merge becomes a duplicate.
  //   If the $v39_to_add archive does not exist, the merge is a success.
  // Parameters :
  //   $v39_to_add : It can be directly the filename of a valid zip archive,
  //                       or a c1 object archive.
  // Return Values :
  //   1 on success,
  //   0 or negative values on error (see below).
  // --------------------------------------------------------------------------------
  function merge($v39_to_add)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::merge", "");
    $v9 = 1;

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Check archive
    if (!$this->f15()) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return(0);
    }

    // ----- Look if the $v39_to_add is a c1 object
    if ((is_object($v39_to_add)) && (get_class($v39_to_add) == 'c1'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid c1 object");

      // ----- Merge the archive
      $v9 = $this->privMerge($v39_to_add);
    }

    // ----- Look if the $v39_to_add is a string (so a filename)
    else if (is_string($v39_to_add))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");

      // ----- Create a temporary archive
      $v_object_archive = new c1($v39_to_add);

      // ----- Merge the archive
      $v9 = $this->privMerge($v_object_archive);
    }

    // ----- Invalid variable
    else
    {
      // ----- Error log
      c1::f4(d10, "Invalid variable type p_archive_to_add");
      $v9 = d10;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------



  // --------------------------------------------------------------------------------
  // Function : f9()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function f9()
  {
    if (d3 == 1) {
      return(Pclf9());
    }
    else {
      return($this->error_code);
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : errorName()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function errorName($p_with_code=false)
  {
    $v_name = array ( d7 => 'd7',
                      d8 => 'd8',
                      d9 => 'd9',
                      d10 => 'd10',
                      d11 => 'd11',
                      d12 => 'd12',
                      d13 => 'd13',
                      d14 => 'd14',
                      d15 => 'd15',
                      d16 => 'd16',
                      d17 => 'd17',
                      d18 => 'd18',
                      d19 => 'd19',
                      d20 => 'd20',
                      d21 => 'd21',
                      d22 => 'd22',
                      d23 => 'd23',
                      d25 => 'd25',
                      d26 => 'd26'
                      ,d27 => 'd27'
                      ,d28 => 'd28'
                    );

    if (isset($v_name[$this->error_code])) {
      $v_value = $v_name[$this->error_code];
    }
    else {
      $v_value = 'NoName';
    }

    if ($p_with_code) {
      return($v_value.' ('.$this->error_code.')');
    }
    else {
      return($v_value);
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : errorInfo()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function errorInfo($p_full=false)
  {
    if (d3 == 1) {
      return(PclErrorString());
    }
    else {
      if ($p_full) {
        return($this->errorName(true)." : ".$this->error_string);
      }
      else {
        return($this->error_string." [code ".$this->error_code."]");
      }
    }
  }
  // --------------------------------------------------------------------------------


// --------------------------------------------------------------------------------
// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
// *****                                                        *****
// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
// --------------------------------------------------------------------------------



  // --------------------------------------------------------------------------------
  // Function : f15()
  // Description :
  //   This method check that the archive exists and is a valid zip archive.
  //   Several level of check exists. (futur)
  // Parameters :
  //   $p_level : Level of check. Default 0.
  //              0 : Check the first bytes (magic codes) (default value))
  //              1 : 0 + Check the central directory (futur)
  //              2 : 1 + Check each file header (futur)
  // Return Values :
  //   true on success,
  //   false on error, the error code is set.
  // --------------------------------------------------------------------------------
  function f15($p_level=0)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f15", "");
    $v9 = true;

	// ----- Reset the file system cache
    clearstatcache();

    // ----- Reset the error handler
    $this->privErrorReset();

    // ----- Look if the file exits
    if (!is_file($this->zipname)) {
      // ----- Error log
      c1::f4(d11, "Missing archive file '".$this->zipname."'");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, c1::errorInfo());
      return(false);
    }

    // ----- Check that the file is readeable
    if (!is_readable($this->zipname)) {
      // ----- Error log
      c1::f4(d9, "Unable to read archive '".$this->zipname."'");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, c1::errorInfo());
      return(false);
    }

    // ----- Check the magic code
    // TBC

    // ----- Check the central header
    // TBC

    // ----- Check each file header
    // TBC

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f3()
  // Description :
  //   This internal methods reads the variable list of arguments ($v36_list,
  //   $v44) and generate an array with the options and values ($v9_list).
  //   $v_requested_options contains the options that can be present and those that
  //   must be present.
  //   $v_requested_options is an array, with the option value as key, and 'optional',
  //   or 'mandatory' as value.
  // Parameters :
  //   See above.
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function f3(&$v36_list, $v44, &$v9_list, $v_requested_options=false)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f3", "");
    $v9=1;
    
    // ----- Read the options
    $o=0;
    while ($o<$v44) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $o, option = '".f13($v36_list[$o])."(".$v36_list[$o].")'");

      // ----- Check if the option is supported
      if (!isset($v_requested_options[$v36_list[$o]])) {
        // ----- Error log
        c1::f4(d10, "Invalid optional parameter '".$v36_list[$o]."' for this method");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }

      // ----- Look for next option
      switch ($v36_list[$o]) {
        // ----- Look for options that request a path value
        case d29 :
        case d31 :
        case d30 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          $v9_list[$v36_list[$o]] = c1UtilTranslateWinPath($v36_list[$o+1], FALSE);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        case ddd46 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          
          // ----- Check for incompatible options
          if (isset($v9_list[d50])) {
            c1::f4(d10, "Option '".f13($v36_list[$o])."' can not be used with option 'd50'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          
          // ----- Check the value
          $v_value = $v36_list[$o+1];
          if ((!is_integer($v_value)) || ($v_value<0)) {
            c1::f4(d23, "Integer expected for option '".f13($v36_list[$o])."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value (and convert it in bytes)
          $v9_list[$v36_list[$o]] = $v_value*1048576;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        case ddd48 :
          // ----- Check for incompatible options
          if (isset($v9_list[d50])) {
            c1::f4(d10, "Option '".f13($v36_list[$o])."' can not be used with option 'd50'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          
          $v9_list[$v36_list[$o]] = true;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
        break;

        case d50 :
          // ----- Check for incompatible options
          if (isset($v9_list[ddd48])) {
            c1::f4(d10, "Option '".f13($v36_list[$o])."' can not be used with option 'ddd48'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          // ----- Check for incompatible options
          if (isset($v9_list[ddd46])) {
            c1::f4(d10, "Option '".f13($v36_list[$o])."' can not be used with option 'ddd46'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          
          $v9_list[$v36_list[$o]] = true;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
        break;

        case ddd45 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          if (   is_string($v36_list[$o+1])
              && ($v36_list[$o+1] != '')) {
            $v9_list[$v36_list[$o]] = c1UtilTranslateWinPath($v36_list[$o+1], FALSE);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
            $o++;
          }
          else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." set with an empty value is ignored.");
          }
        break;

        // ----- Look for options that request an array of string for value
        case d36 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          if (is_string($v36_list[$o+1])) {
              $v9_list[$v36_list[$o]][0] = $v36_list[$o+1];
          }
          else if (is_array($v36_list[$o+1])) {
              $v9_list[$v36_list[$o]] = $v36_list[$o+1];
          }
          else {
            // ----- Error log
            c1::f4(d23, "Wrong parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        // ----- Look for options that request an EREG or PREG expression
        case d38 :
        case d39 :
        //case c1_OPT_CRYPT :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          if (is_string($v36_list[$o+1])) {
              $v9_list[$v36_list[$o]] = $v36_list[$o+1];
          }
          else {
            // ----- Error log
            c1::f4(d23, "Wrong parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        // ----- Look for options that takes a string
        case d40 :
        case d41 :
        case d42 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22,
			                     "Missing parameter value for option '"
								 .f13($v36_list[$o])
								 ."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          if (is_string($v36_list[$o+1])) {
              $v9_list[$v36_list[$o]] = $v36_list[$o+1];
          }
          else {
            // ----- Error log
            c1::f4(d23,
			                     "Wrong parameter value for option '"
								 .f13($v36_list[$o])
								 ."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        // ----- Look for options that request an array of index
        case d37 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          $v56 = array();
          if (is_string($v36_list[$o+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$v36_list[$o+1]."'");

              // ----- Remove spaces
              $v36_list[$o+1] = strtr($v36_list[$o+1], ' ', '');

              // ----- Parse items
              $v56 = explode(",", $v36_list[$o+1]);
          }
          else if (is_integer($v36_list[$o+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$v36_list[$o+1]."'");
              $v56[0] = $v36_list[$o+1].'-'.$v36_list[$o+1];
          }
          else if (is_array($v36_list[$o+1])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
              $v56 = $v36_list[$o+1];
          }
          else {
            // ----- Error log
            c1::f4(d23, "Value must be integer, string or array for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
          
          // ----- Reduce the index list
          // each index item in the list must be a couple with a start and
          // an end value : [0,3], [5-5], [8-10], ...
          // ----- Check the format of each item
          $v_sort_flag=false;
          $v_sort_value=0;
          for ($h=0; $h<sizeof($v56); $h++) {
              // ----- Explode the item
              $v_item_list = explode("-", $v56[$h]);
              $v8_item_list = sizeof($v_item_list);
              
              // ----- TBC : Here we might check that each item is a
              // real integer ...
              
              // ----- Look for single value
              if ($v8_item_list == 1) {
                  // ----- Set the option value
                  $v9_list[$v36_list[$o]][$h]['start'] = $v_item_list[0];
                  $v9_list[$v36_list[$o]][$h]['end'] = $v_item_list[0];
              }
              elseif ($v8_item_list == 2) {
                  // ----- Set the option value
                  $v9_list[$v36_list[$o]][$h]['start'] = $v_item_list[0];
                  $v9_list[$v36_list[$o]][$h]['end'] = $v_item_list[1];
              }
              else {
                  // ----- Error log
                  c1::f4(d23, "Too many values in index range for option '".f13($v36_list[$o])."'");

                  // ----- Return
                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
                  return c1::f9();
              }

              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v9_list[$v36_list[$o]][$h]['start'].",".$v9_list[$v36_list[$o]][$h]['end']."]");

              // ----- Look for list sort
              if ($v9_list[$v36_list[$o]][$h]['start'] < $v_sort_value) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
                  $v_sort_flag=true;

                  // ----- TBC : An automatic sort should be writen ...
                  // ----- Error log
                  c1::f4(d23, "Invalid order of index range for option '".f13($v36_list[$o])."'");

                  // ----- Return
                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
                  return c1::f9();
              }
              $v_sort_value = $v9_list[$v36_list[$o]][$h]['start'];
          }
          
          // ----- Sort the items
          if ($v_sort_flag) {
              // TBC : To Be Completed
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
          }

          // ----- Next option
          $o++;
        break;

        // ----- Look for options that request no value
        case d32 :
        case d34 :
        case d35 :
        case d43 :
        case d44 :
        case d45 :
          $v9_list[$v36_list[$o]] = true;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
        break;

        // ----- Look for options that request an octal value
        case d33 :
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          $v9_list[$v36_list[$o]] = $v36_list[$o+1];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v36_list[$o])." = '".$v9_list[$v36_list[$o]]."'");
          $o++;
        break;

        // ----- Look for options that request a call-back
        case d58 :
        case d59 :
        case d60 :
        case d61 :
        /* for futur use
        case c1_CB_PRE_DELETE :
        case c1_CB_POST_DELETE :
        case c1_CB_PRE_LIST :
        case c1_CB_POST_LIST :
        */
          // ----- Check the number of parameters
          if (($o+1) >= $v44) {
            // ----- Error log
            c1::f4(d22, "Missing parameter value for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Get the value
          $v_function_name = $v36_list[$o+1];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".f13($v36_list[$o])." = '".$v_function_name."'");

          // ----- Check that the value is a valid existing function
          if (!function_exists($v_function_name)) {
            // ----- Error log
            c1::f4(d23, "Function '".$v_function_name."()' is not an existing function for option '".f13($v36_list[$o])."'");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          // ----- Set the attribute
          $v9_list[$v36_list[$o]] = $v_function_name;
          $o++;
        break;

        default :
          // ----- Error log
          c1::f4(d10,
		                       "Unknown parameter '"
							   .$v36_list[$o]."'");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return c1::f9();
      }

      // ----- Next options
      $o++;
    }

    // ----- Look for mandatory options
    if ($v_requested_options !== false) {
      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
        // ----- Look for mandatory option
        if ($v_requested_options[$key] == 'mandatory') {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".f13($key)."(".$key.")");
          // ----- Look if present
          if (!isset($v9_list[$key])) {
            // ----- Error log
            c1::f4(d10, "Missing mandatory parameter ".f13($key)."(".$key.")");

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
        }
      }
    }
    
    // ----- Look for default values
    if (!isset($v9_list[ddd46])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
      
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f2()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f2(&$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f2", "");
    $v9=1;
    
    if (isset($v36[ddd46])
        || isset($v36[d50])) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }
    
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
    // ----- Get 'memory_limit' configuration value
    $v_memory_limit = ini_get('memory_limit');
    $v_memory_limit = trim($v_memory_limit);
    $last = strtolower(substr($v_memory_limit, -1));
 
    if($last == 'g')
        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
        $v_memory_limit = $v_memory_limit*1073741824;
    if($last == 'm')
        //$v_memory_limit = $v_memory_limit*1024*1024;
        $v_memory_limit = $v_memory_limit*1048576;
    if($last == 'k')
        $v_memory_limit = $v_memory_limit*1024;
            
    $v36[ddd46] = floor($v_memory_limit*d5);
    
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$v36[ddd46]." bytes");

    // ----- Sanity check : No threshold if value lower than 1M
    if ($v36[ddd46] < 1048576) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$v36[ddd46].") because under 1Mo sanity check)");
      unset($v36[ddd46]);
    }
          
    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privFileDescrParseAtt()
  // Description :
  // Parameters :
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function privFileDescrParseAtt(&$v35_list, &$v35descr, $v6, $v_requested_options=false)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privFileDescrParseAtt", "");
    $v9=1;
    
    // ----- For each file in the list check the attributes
    foreach ($v35_list as $v_key => $v_value) {
    
      // ----- Check if the option is supported
      if (!isset($v_requested_options[$v_key])) {
        // ----- Error log
        c1::f4(d10, "Invalid file attribute '".$v_key."' for this file");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }

      // ----- Look for attribute
      switch ($v_key) {
        case d52 :
          if (!is_string($v_value)) {
            c1::f4(d27, "Invalid type ".gettype($v_value).". String expected for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          $v35descr['filename'] = c1UtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");
          
          if ($v35descr['filename'] == '') {
            c1::f4(d27, "Invalid empty filename for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

        break;

        case d53 :
          if (!is_string($v_value)) {
            c1::f4(d27, "Invalid type ".gettype($v_value).". String expected for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          $v35descr['new_short_name'] = c1UtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");

          if ($v35descr['new_short_name'] == '') {
            c1::f4(d27, "Invalid empty short filename for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
        break;

        case d54 :
          if (!is_string($v_value)) {
            c1::f4(d27, "Invalid type ".gettype($v_value).". String expected for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          $v35descr['new_full_name'] = c1UtilPathReduction($v_value);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");

          if ($v35descr['new_full_name'] == '') {
            c1::f4(d27, "Invalid empty full filename for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }
        break;

        // ----- Look for options that takes a string
        case d57 :
          if (!is_string($v_value)) {
            c1::f4(d27, "Invalid type ".gettype($v_value).". String expected for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          $v35descr['comment'] = $v_value;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");
        break;

        case d55 :
          if (!is_integer($v_value)) {
            c1::f4(d27, "Invalid type ".gettype($v_value).". Integer expected for attribute '".f13($v_key)."'");
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }

          $v35descr['mtime'] = $v_value;
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");
        break;

        case d56 :
          $v35descr['content'] = $v_value;
          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".f13($v_key)." = '".$v_value."'");
        break;

        default :
          // ----- Error log
          c1::f4(d10,
		                           "Unknown parameter '".$v_key."'");

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return c1::f9();
      }

      // ----- Look for mandatory options
      if ($v_requested_options !== false) {
        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
          // ----- Look for mandatory option
          if ($v_requested_options[$key] == 'mandatory') {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".f13($key)."(".$key.")");
            // ----- Look if present
            if (!isset($v35_list[$key])) {
              c1::f4(d10, "Missing mandatory parameter ".f13($key)."(".$key.")");
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
              return c1::f9();
            }
          }
        }
      }
    
    // end foreach
    }
    
    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privFileDescrExpand()
  // Description :
  //   This method look for each item of the list to see if its a file, a folder
  //   or a string to be added as file. For any other type of files (link, other)
  //   just ignore the item.
  //   Then prepare the information that will be stored for that file.
  //   When its a folder, expand the folder with all the files that are in that 
  //   folder (recursively).
  // Parameters :
  // Return Values :
  //   1 on success.
  //   0 on failure.
  // --------------------------------------------------------------------------------
  function privFileDescrExpand(&$v35descr_list, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privFileDescrExpand", "");
    $v9=1;
    
    // ----- Create a result list
    $v9_list = array();
    
    // ----- Look each entry
    for ($o=0; $o<sizeof($v35descr_list); $o++) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$o.".");
      
      // ----- Get filedescr
      $v_descr = $v35descr_list[$o];
      
      // ----- Reduce the filename
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
      $v_descr['filename'] = c1UtilTranslateWinPath($v_descr['filename'], false);
      $v_descr['filename'] = c1UtilPathReduction($v_descr['filename']);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
      
      // ----- Look for real file or folder
      if (file_exists($v_descr['filename'])) {
        if (@is_file($v_descr['filename'])) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
          $v_descr['type'] = 'file';
        }
        else if (@is_dir($v_descr['filename'])) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
          $v_descr['type'] = 'folder';
        }
        else if (@is_link($v_descr['filename'])) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
          // skip
          continue;
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
          // skip
          continue;
        }
      }
      
      // ----- Look for string added as file
      else if (isset($v_descr['content'])) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
        $v_descr['type'] = 'virtual_file';
      }
      
      // ----- Missing file
      else {
        // ----- Error log
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exist");
        c1::f4(d11, "File '".$v_descr['filename']."' does not exist");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }
      
      // ----- Calculate the stored filename
      $this->privCalculateStoredFilename($v_descr, $v36);
      
      // ----- Add the descriptor in result list
      $v9_list[sizeof($v9_list)] = $v_descr;
      
      // ----- Look for folder
      if ($v_descr['type'] == 'folder') {
        // ----- List of items in folder
        $v_dirlist_descr = array();
        $v_dirlist_nb = 0;
        if ($v_folder_handler = @opendir($v_descr['filename'])) {
          while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");

            // ----- Skip '.' and '..'
            if (($v_item_handler == '.') || ($v_item_handler == '..')) {
                continue;
            }
            
            // ----- Compose the full filename
            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
            
            // ----- Look for different stored filename
            // Because the name of the folder was changed, the name of the
            // files/sub-folders also change
            if ($v_descr['stored_filename'] != $v_descr['filename']) {
              if ($v_descr['stored_filename'] != '') {
                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
              }
              else {
                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
              }
            }
      
            $v_dirlist_nb++;
          }
          
          @closedir($v_folder_handler);
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
          // TBC : unable to open folder in read mode
        }
        
        // ----- Expand each element of the list
        if ($v_dirlist_nb != 0) {
          // ----- Expand
          if (($v9 = $this->privFileDescrExpand($v_dirlist_descr, $v36)) != 1) {
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
          }
          
          // ----- Concat the resulting list
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v9_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
          $v9_list = array_merge($v9_list, $v_dirlist_descr);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v9_list)."'");
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
        }
          
        // ----- Free local array
        unset($v_dirlist_descr);
      }
    }
    
    // ----- Get the result list
    $v35descr_list = $v9_list;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCreate()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privCreate($v35descr_list, &$v13, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privCreate", "list");
    $v9=1;
    $v24_detail = array();
    
    // ----- Magic quotes trick
    $this->f14();

    // ----- Open the file in write mode
    if (($v9 = $this->privOpenFd('wb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Add the list of files
    $v9 = $this->privAddList($v35descr_list, $v13, $v36);

    // ----- Close
    $this->f6();

    // ----- Magic quotes trick
    $this->f8();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAdd()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAdd($v35descr_list, &$v13, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privAdd", "list");
    $v9=1;
    $v24_detail = array();

    // ----- Look if the archive exists or is empty
    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");

      // ----- Do a create
      $v9 = $this->privCreate($v35descr_list, $v13, $v36);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }
    // ----- Magic quotes trick
    $this->f14();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v9=$this->privOpenFd('rb')) != 1)
    {
      // ----- Magic quotes trick
      $this->f8();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Read the central directory informations
    $v40 = array();
    if (($v9 = $this->f11($v40)) != 1)
    {
      $this->f6();
      $this->f8();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Creates a temporay file
    $v_zip_temp_name = d4.uniqid('c1-').'.tmp';

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v50 = @fopen($v_zip_temp_name, 'wb')) == 0)
    {
      $this->f6();
      $this->f8();

      c1::f4(d9, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v8 = $v40['offset'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = fread($this->zip_fd, $v57);
      @fwrite($v50, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Swap the file descriptor
    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
    // the following methods on the temporary fil and not the real archive
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v50;
    $v50 = $v_swap;

    // ----- Add the files
    $v25_list = array();
    if (($v9 = $this->privAddFileList($v35descr_list, $v25_list, $v36)) != 1)
    {
      fclose($v50);
      $this->f6();
      @unlink($v_zip_temp_name);
      $this->f8();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Store the offset of the central dir
    $v52 = @ftell($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v52");

    // ----- Copy the block of file headers from the old archive
    $v8 = $v40['size'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = @fread($v50, $v57);
      @fwrite($this->zip_fd, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Create the Central Dir files header
    for ($o=0, $v_count=0; $o<sizeof($v25_list); $o++)
    {
      // ----- Create the file header
      if ($v25_list[$o]['status'] == 'ok') {
        if (($v9 = $this->privWriteCentralFileHeader($v25_list[$o])) != 1) {
          fclose($v50);
          $this->f6();
          @unlink($v_zip_temp_name);
          $this->f8();

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }
        $v_count++;
      }

      // ----- Transform the header to a 'usable' info
      $this->f12($v25_list[$o], $v13[$o]);
    }

    // ----- Zip file comment
    $v53 = $v40['comment'];
    if (isset($v36[d40])) {
      $v53 = $v36[d40];
    }
    if (isset($v36[d41])) {
      $v53 = $v53.$v36[d41];
    }
    if (isset($v36[d42])) {
      $v53 = $v36[d42].$v53;
    }

    // ----- Calculate the size of the central header
    $v8 = @ftell($this->zip_fd)-$v52;

    // ----- Create the central dir footer
    if (($v9 = $this->f17($v_count+$v40['entries'], $v8, $v52, $v53)) != 1)
    {
      // ----- Reset the file list
      unset($v25_list);
      $this->f8();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Swap back the file descriptor
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v50;
    $v50 = $v_swap;

    // ----- Close
    $this->f6();

    // ----- Close the temporary file
    @fclose($v50);

    // ----- Magic quotes trick
    $this->f8();

    // ----- Delete the zip file
    // TBC : I should test the result ...
    @unlink($this->zipname);

    // ----- Rename the temporary file
    // TBC : I should test the result ...
    //@rename($v_zip_temp_name, $this->zipname);
    c1UtilRename($v_zip_temp_name, $this->zipname);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privOpenFd()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privOpenFd($p_mode)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privOpenFd", 'mode='.$p_mode);
    $v9=1;

    // ----- Look if already open
    if ($this->zip_fd != 0)
    {
      // ----- Error log
      c1::f4(d9, 'Zip file \''.$this->zipname.'\' already open');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
    {
      // ----- Error log
      c1::f4(d9, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f6()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function f6()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f6", "");
    $v9=1;

    if ($this->zip_fd != 0)
      @fclose($this->zip_fd);
    $this->zip_fd = 0;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddList()
  // Description :
  //   $p_add_dir and $v60 will give the ability to memorize a path which is
  //   different from the real path of the file. This is usefull if you want to have PclTar
  //   running in any directory, and memorize relative path from an other directory.
  // Parameters :
  //   $v20 : An array containing the file or directory names to add in the tar
  //   $v13 : list of added files with their properties (specially the status field)
  //   $p_add_dir : Path to add in the filename path archived
  //   $v60 : Path to remove in the filename path archived
  // Return Values :
  // --------------------------------------------------------------------------------
//  function privAddList($v20, &$v13, $p_add_dir, $v60, $p_remove_all_dir, &$v36)
  function privAddList($v35descr_list, &$v13, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privAddList", "list");
    $v9=1;

    // ----- Add the files
    $v25_list = array();
    if (($v9 = $this->privAddFileList($v35descr_list, $v25_list, $v36)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Store the offset of the central dir
    $v52 = @ftell($this->zip_fd);

    // ----- Create the Central Dir files header
    for ($o=0,$v_count=0; $o<sizeof($v25_list); $o++)
    {
      // ----- Create the file header
      if ($v25_list[$o]['status'] == 'ok') {
        if (($v9 = $this->privWriteCentralFileHeader($v25_list[$o])) != 1) {
          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }
        $v_count++;
      }

      // ----- Transform the header to a 'usable' info
      $this->f12($v25_list[$o], $v13[$o]);
    }

    // ----- Zip file comment
    $v53 = '';
    if (isset($v36[d40])) {
      $v53 = $v36[d40];
    }

    // ----- Calculate the size of the central header
    $v8 = @ftell($this->zip_fd)-$v52;

    // ----- Create the central dir footer
    if (($v9 = $this->f17($v_count, $v8, $v52, $v53)) != 1)
    {
      // ----- Reset the file list
      unset($v25_list);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddFileList()
  // Description :
  // Parameters :
  //   $v35descr_list : An array containing the file description 
  //                      or directory names to add in the zip
  //   $v13 : list of added files with their properties (specially the status field)
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAddFileList($v35descr_list, &$v13, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privAddFileList", "filedescr_list");
    $v9=1;
    $v25 = array();

    // ----- Recuperate the current number of elt in list
    $v_nb = sizeof($v13);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");

    // ----- Loop on the files
    for ($h=0; ($h<sizeof($v35descr_list)) && ($v9==1); $h++) {
      // ----- Format the filename
      $v35descr_list[$h]['filename']
      = c1UtilTranslateWinPath($v35descr_list[$h]['filename'], false);
      
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$v35descr_list[$h]['filename']."'");

      // ----- Skip empty file names
      // TBC : Can this be possible ? not checked in DescrParseAtt ?
      if ($v35descr_list[$h]['filename'] == "") {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
        continue;
      }

      // ----- Check the filename
      if (   ($v35descr_list[$h]['type'] != 'virtual_file')
          && (!file_exists($v35descr_list[$h]['filename']))) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v35descr_list[$h]['filename']."' does not exist");
        c1::f4(d11, "File '".$v35descr_list[$h]['filename']."' does not exist");
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }

      // ----- Look if it is a file or a dir with no all path remove option
      // or a dir with all its path removed
//      if (   (is_file($v35descr_list[$h]['filename']))
//          || (   is_dir($v35descr_list[$h]['filename'])
      if (   ($v35descr_list[$h]['type'] == 'file')
          || ($v35descr_list[$h]['type'] == 'virtual_file')
          || (   ($v35descr_list[$h]['type'] == 'folder')
              && (   !isset($v36[d32])
                  || !$v36[d32]))
          ) {

        // ----- Add the file
        $v9 = $this->privAddFile($v35descr_list[$h], $v25,
                                       $v36);
        if ($v9 != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }

        // ----- Store the file infos
        $v13[$v_nb++] = $v25;
      }
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddFile()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAddFile($v35descr, &$v33, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privAddFile", "filename='".$v35descr['filename']."'");
    $v9=1;
    
    // ----- Working variable
    $v35name = $v35descr['filename'];

    // TBC : Already done in the fileAtt check ... ?
    if ($v35name == "") {
      // ----- Error log
      c1::f4(d10, "Invalid file list parameter (invalid or empty list)");

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }
  
    // ----- Look for a stored different filename 
    /* TBC : Removed
    if (isset($v35descr['stored_filename'])) {
      $v55 = $v35descr['stored_filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v55.'"');
    }
    else {
      $v55 = $v35descr['stored_filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
    }
    */

    // ----- Set the file properties
    clearstatcache();
    $v33['version'] = 20;
    $v33['version_extracted'] = 10;
    $v33['flag'] = 0;
    $v33['compression'] = 0;
    $v33['crc'] = 0;
    $v33['compressed_size'] = 0;
    $v33['filename_len'] = strlen($v35name);
    $v33['extra_len'] = 0;
    $v33['disk'] = 0;
    $v33['internal'] = 0;
    $v33['offset'] = 0;
    $v33['filename'] = $v35name;
// TBC : Removed    $v33['stored_filename'] = $v55;
    $v33['stored_filename'] = $v35descr['stored_filename'];
    $v33['extra'] = '';
    $v33['status'] = 'ok';
    $v33['index'] = -1;

    // ----- Look for regular file
    if ($v35descr['type']=='file') {
      $v33['external'] = 0x00000000;
      $v33['size'] = filesize($v35name);
    }
    
    // ----- Look for regular folder
    else if ($v35descr['type']=='folder') {
      $v33['external'] = 0x00000010;
      $v33['mtime'] = filemtime($v35name);
      $v33['size'] = filesize($v35name);
    }
    
    // ----- Look for virtual file
    else if ($v35descr['type'] == 'virtual_file') {
      $v33['external'] = 0x00000000;
      $v33['size'] = strlen($v35descr['content']);
    }
    
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$v33['external'])."'");

    // ----- Look for filetime
    if (isset($v35descr['mtime'])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Overload mtime value with :'".$v35descr['mtime']."'");
      $v33['mtime'] = $v35descr['mtime'];
    }
    else if ($v35descr['type'] == 'virtual_file') {
      $v33['mtime'] = time();
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Virtual file : use current time '".$v33['mtime']."' for mtime value.");
    }
    else {
      $v33['mtime'] = filemtime($v35name);
    }

    // ------ Look for file comment
    if (isset($v35descr['comment'])) {
      $v33['comment_len'] = strlen($v35descr['comment']);
      $v33['comment'] = $v35descr['comment'];
    }
    else {
      $v33['comment_len'] = 0;
      $v33['comment'] = '';
    }

    // ----- Look for pre-add callback
    if (isset($v36[d60])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$v36[d60]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v33, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d60].'(d60, $v61);');
      if ($v9 == 0) {
        // ----- Change the file status
        $v33['status'] = "skipped";
        $v9 = 1;
      }

      // ----- Update the informations
      // Only some fields can be modified
      if ($v33['stored_filename'] != $v61['stored_filename']) {
        $v33['stored_filename'] = c1UtilPathReduction($v61['stored_filename']);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$v33['stored_filename']."'");
      }
    }

    // ----- Look for empty stored filename
    if ($v33['stored_filename'] == "") {
      $v33['status'] = "filtered";
    }
    
    // ----- Check the path length
    if (strlen($v33['stored_filename']) > 0xFF) {
      $v33['status'] = 'filename_too_long';
    }

    // ----- Look if no error, or file not skipped
    if ($v33['status'] == 'ok') {

      // ----- Look for a file
      if ($v35descr['type'] == 'file') {
        // ----- Look for using temporary file to zip
        if ( (!isset($v36[d50])) 
            && (isset($v36[ddd48])
                || (isset($v36[ddd46])
                    && ($v36[ddd46] <= $v33['size'])) ) ) {
          $v9 = $this->privAddFileUsingTempFile($v35descr, $v33, $v36);
          if ($v9 < d7) {
            return $v9;
          }
        }
        
        // ----- Use "in memory" zip algo
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");      
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");      
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");      
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$v35name."' is a file");

        // ----- Open the source file
        if (($v34 = @fopen($v35name, "rb")) == 0) {
          c1::f4(d9, "Unable to open file '$v35name' in binary read mode");
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return c1::f9();
        }

        // ----- Read the file content
        $v62 = @fread($v34, $v33['size']);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");      
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");      

        // ----- Close the file
        @fclose($v34);

        // ----- Calculate the CRC
        $v33['crc'] = @crc32($v62);
        
        // ----- Look for no compression
        if ($v36[d35]) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
          // ----- Set header parameters
          $v33['compressed_size'] = $v33['size'];
          $v33['compression'] = 0;
        }
        
        // ----- Look for normal compression
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
          // ----- Compress the content
          $v62 = @gzdeflate($v62);
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");      
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");      

          // ----- Set header parameters
          $v33['compressed_size'] = strlen($v62);
          $v33['compression'] = 8;
        }
        
        // ----- Call the header generation
        if (($v9 = $this->privWriteFileHeader($v33)) != 1) {
          @fclose($v34);
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }

        // ----- Write the compressed (or not) content
        @fwrite($this->zip_fd, $v62, $v33['compressed_size']);

        }

      }

      // ----- Look for a virtual file (a file from string)
      else if ($v35descr['type'] == 'virtual_file') {
          
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
        $v62 = $v35descr['content'];

        // ----- Calculate the CRC
        $v33['crc'] = @crc32($v62);
        
        // ----- Look for no compression
        if ($v36[d35]) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
          // ----- Set header parameters
          $v33['compressed_size'] = $v33['size'];
          $v33['compression'] = 0;
        }
        
        // ----- Look for normal compression
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
          // ----- Compress the content
          $v62 = @gzdeflate($v62);

          // ----- Set header parameters
          $v33['compressed_size'] = strlen($v62);
          $v33['compression'] = 8;
        }
        
        // ----- Call the header generation
        if (($v9 = $this->privWriteFileHeader($v33)) != 1) {
          @fclose($v34);
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }

        // ----- Write the compressed (or not) content
        @fwrite($this->zip_fd, $v62, $v33['compressed_size']);
      }

      // ----- Look for a directory
      else if ($v35descr['type'] == 'folder') {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$v35name."' is a folder");
        // ----- Look for directory last '/'
        if (@substr($v33['stored_filename'], -1) != '/') {
          $v33['stored_filename'] .= '/';
        }

        // ----- Set the file properties
        $v33['size'] = 0;
        //$v33['external'] = 0x41FF0010;   // Value for a folder : to be checked
        $v33['external'] = 0x00000010;   // Value for a folder : to be checked

        // ----- Call the header generation
        if (($v9 = $this->privWriteFileHeader($v33)) != 1)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }
      }
    }

    // ----- Look for post-add callback
    if (isset($v36[d61])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$v36[d61]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v33, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d61].'(d61, $v61);');
      if ($v9 == 0) {
        // ----- Ignored
        $v9 = 1;
      }

      // ----- Update the informations
      // Nothing can be modified
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privAddFileUsingTempFile()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privAddFileUsingTempFile($v35descr, &$v33, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privAddFileUsingTempFile", "filename='".$v35descr['filename']."'");
    $v9=d7;
    
    // ----- Working variable
    $v35name = $v35descr['filename'];

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$v35name."' is a file");

    // ----- Open the source file
    if (($v34 = @fopen($v35name, "rb")) == 0) {
      c1::f4(d9, "Unable to open file '$v35name' in binary read mode");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Creates a compressed temporary file
    $v46 = d4.uniqid('c1-').'.gz';
    if (($v34_compressed = @gzopen($v46, "wb")) == 0) {
      fclose($v34);
      c1::f4(d8, 'Unable to open temporary file \''.$v46.'\' in binary write mode');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the file by d1 octets blocks
    $v8 = filesize($v35name);
    while ($v8 != 0) {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v57." bytes");
      $v37 = @fread($v34, $v57);
      //$v47 = pack('a'.$v57, $v37);
      @gzputs($v34_compressed, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Close the file
    @fclose($v34);
    @gzclose($v34_compressed);

    // ----- Check the minimum file size
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "gzip file size ".filesize($v46));
    if (filesize($v46) < 18) {
      c1::f4(d17, 'gzip temporary file \''.$v46.'\' has invalid filesize - should be minimum 18 bytes');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Extract the compressed attributes
    if (($v34_compressed = @fopen($v46, "rb")) == 0) {
      c1::f4(d9, 'Unable to open temporary file \''.$v46.'\' in binary read mode');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the gzip file header
    $v47 = @fread($v34_compressed, 10);
    $v26_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v47);

    // ----- Check some parameters
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[id1]='.bin2hex($v26_header['id1']));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[id2]='.bin2hex($v26_header['id2']));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[cm]='.bin2hex($v26_header['cm']));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[flag]='.bin2hex($v26_header['flag']));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[mtime]='.$v26_header['mtime']);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[xfl]='.bin2hex($v26_header['xfl']));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, '$v26_header[os]='.bin2hex($v26_header['os']));
    $v26_header['os'] = bin2hex($v26_header['os']);

    // ----- Read the gzip file footer
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after header ".ftell($v34_compressed));
    @fseek($v34_compressed, filesize($v46)-8);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position at beginning of footer ".ftell($v34_compressed));
    $v47 = @fread($v34_compressed, 8);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after footer ".ftell($v34_compressed));
    $v26_footer = unpack('Vcrc/Vcompressed_size', $v47);

    // ----- Set the attributes
    $v33['compression'] = ord($v26_header['cm']);
    //$v33['mtime'] = $v26_header['mtime'];
    $v33['crc'] = $v26_footer['crc'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Compressed size ".(filesize($v46)-18));
    $v33['compressed_size'] = filesize($v46)-18;

    // ----- Close the file
    @fclose($v34_compressed);

    // ----- Call the header generation
    if (($v9 = $this->privWriteFileHeader($v33)) != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Add the compressed data
    if (($v34_compressed = @fopen($v46, "rb")) == 0)
    {
      c1::f4(d9, 'Unable to open temporary file \''.$v46.'\' in binary read mode');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the file by d1 octets blocks
    fseek($v34_compressed, 10);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File position before reading compressed data ".ftell($v34_compressed));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, ' '.$v33['compressed_size'].' bytes to read');
    $v8 = $v33['compressed_size'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v57." bytes");
      $v37 = @fread($v34_compressed, $v57);
      //$v47 = pack('a'.$v57, $v37);
      @fwrite($this->zip_fd, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Close the file
    @fclose($v34_compressed);

    // ----- Unlink the temporary file
    @unlink($v46);
    
    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privCalculateStoredFilename()
  // Description :
  //   Based on file descriptor properties and global options, this method
  //   calculate the filename that will be stored in the archive.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privCalculateStoredFilename(&$v35descr, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privCalculateStoredFilename", "filename='".$v35descr['filename']."'");
    $v9=1;
    
    // ----- Working variables
    $v35name = $v35descr['filename'];
    if (isset($v36[d30])) {
      $p_add_dir = $v36[d30];
    }
    else {
      $p_add_dir = '';
    }
    if (isset($v36[d31])) {
      $v60 = $v36[d31];
    }
    else {
      $v60 = '';
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Remove path ='".$v60."'");
    if (isset($v36[d32])) {
      $p_remove_all_dir = $v36[d32];
    }
    else {
      $p_remove_all_dir = 0;
    }

    // ----- Look for full name change
    if (isset($v35descr['new_full_name'])) {
      // ----- Remove drive letter if any
      $v55 = c1UtilTranslateWinPath($v35descr['new_full_name']);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$v35name."' for '".$v55."'");
    }
    
    // ----- Look for path and/or short name change
    else {

      // ----- Look for short name change
      // Its when we cahnge just the filename but not the path
      if (isset($v35descr['new_short_name'])) {
        $v21_info = pathinfo($v35name);
        $v_dir = '';
        if ($v21_info['dirname'] != '') {
          $v_dir = $v21_info['dirname'].'/';
        }
        $v55 = $v_dir.$v35descr['new_short_name'];
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$v35name."' for '".$v55."'");
      }
      else {
        // ----- Calculate the stored filename
        $v55 = $v35name;
      }

      // ----- Look for all path to remove
      if ($p_remove_all_dir) {
        $v55 = basename($v35name);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$v35name."' for '".$v55."'");
      }
      // ----- Look for partial path remove
      else if ($v60 != "") {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Partial path to remove");
        if (substr($v60, -1) != '/')
          $v60 .= "/";

        if (   (substr($v35name, 0, 2) == "./")
            || (substr($v60, 0, 2) == "./")) {
            
          if (   (substr($v35name, 0, 2) == "./")
              && (substr($v60, 0, 2) != "./")) {
            $v60 = "./".$v60;
          }
          if (   (substr($v35name, 0, 2) != "./")
              && (substr($v60, 0, 2) == "./")) {
            $v60 = substr($v60, 2);
          }
        }

        $v63 = c1UtilPathInclusion($v60,
                                             $v55);
        if ($v63 > 0) {
          if ($v63 == 2) {
            $v55 = "";
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
          }
          else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$v60' in file '$v55'");
            $v55 = substr($v55,
                                        strlen($v60));
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v55'");
          }
        }
      }
      
      // ----- Remove drive letter if any
      $v55 = c1UtilTranslateWinPath($v55);
      
      // ----- Look for path to add
      if ($p_add_dir != "") {
        if (substr($p_add_dir, -1) == "/")
          $v55 = $p_add_dir.$v55;
        else
          $v55 = $p_add_dir."/".$v55;
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$v35name' = '$v55'");
      }
    }

    // ----- Filename (reduce the path of stored name)
    $v55 = c1UtilPathReduction($v55);
    $v35descr['stored_filename'] = $v55;
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$v35descr['stored_filename']."', strlen ".strlen($v35descr['stored_filename']));
    
    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privWriteFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privWriteFileHeader(&$v33)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privWriteFileHeader", 'file="'.$v33['filename'].'", stored as "'.$v33['stored_filename'].'"');
    $v9=1;

    // ----- Store the offset position of the file
    $v33['offset'] = ftell($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$v33['offset']);

    // ----- Transform UNIX mtime to DOS format mdate/mtime
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    $v42 = getdate($v33['mtime']);
    $v_mtime = ($v42['hours']<<11) + ($v42['minutes']<<5) + $v42['seconds']/2;
    $v_mdate = (($v42['year']-1980)<<9) + ($v42['mon']<<5) + $v42['mday'];

    // ----- Packed data
    $v47 = pack("VvvvvvVVVvv", 0x04034b50,
	                      $v33['version_extracted'], $v33['flag'],
                          $v33['compression'], $v_mtime, $v_mdate,
                          $v33['crc'], $v33['compressed_size'],
						  $v33['size'],
                          strlen($v33['stored_filename']),
						  $v33['extra_len']);

    // ----- Write the first 148 bytes of the header in the archive
    fputs($this->zip_fd, $v47, 30);

    // ----- Write the variable fields
    if (strlen($v33['stored_filename']) != 0)
    {
      fputs($this->zip_fd, $v33['stored_filename'], strlen($v33['stored_filename']));
    }
    if ($v33['extra_len'] != 0)
    {
      fputs($this->zip_fd, $v33['extra'], $v33['extra_len']);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privWriteCentralFileHeader()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privWriteCentralFileHeader(&$v33)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privWriteCentralFileHeader", 'file="'.$v33['filename'].'", stored as "'.$v33['stored_filename'].'"');
    $v9=1;

    // TBC
    //for(reset($v33); $key = key($v33); next($v33)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$v33[$key]);
    //}

    // ----- Transform UNIX mtime to DOS format mdate/mtime
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    $v42 = getdate($v33['mtime']);
    $v_mtime = ($v42['hours']<<11) + ($v42['minutes']<<5) + $v42['seconds']/2;
    $v_mdate = (($v42['year']-1980)<<9) + ($v42['mon']<<5) + $v42['mday'];

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$v33['comment_len'].'\'');

    // ----- Packed data
    $v47 = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
	                      $v33['version'], $v33['version_extracted'],
                          $v33['flag'], $v33['compression'],
						  $v_mtime, $v_mdate, $v33['crc'],
                          $v33['compressed_size'], $v33['size'],
                          strlen($v33['stored_filename']),
						  $v33['extra_len'], $v33['comment_len'],
                          $v33['disk'], $v33['internal'],
						  $v33['external'], $v33['offset']);

    // ----- Write the 42 bytes of the header in the zip file
    fputs($this->zip_fd, $v47, 46);

    // ----- Write the variable fields
    if (strlen($v33['stored_filename']) != 0)
    {
      fputs($this->zip_fd, $v33['stored_filename'], strlen($v33['stored_filename']));
    }
    if ($v33['extra_len'] != 0)
    {
      fputs($this->zip_fd, $v33['extra'], $v33['extra_len']);
    }
    if ($v33['comment_len'] != 0)
    {
      fputs($this->zip_fd, $v33['comment'], $v33['comment_len']);
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f17()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f17($p_nb_entries, $v44, $p_offset, $p_comment)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f17", 'nb_entries='.$p_nb_entries.', size='.$v44.', offset='.$p_offset.', comment="'.$p_comment.'"');
    $v9=1;

    // ----- Packed data
    $v47 = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
	                      $p_nb_entries, $v44,
						  $p_offset, strlen($p_comment));

    // ----- Write the 22 bytes of the header in the zip file
    fputs($this->zip_fd, $v47, 22);

    // ----- Write the variable fields
    if (strlen($p_comment) != 0)
    {
      fputs($this->zip_fd, $p_comment, strlen($p_comment));
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privList()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privList(&$v20)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privList", "list");
    $v9=1;

    // ----- Magic quotes trick
    $this->f14();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
    {
      // ----- Magic quotes trick
      $this->f8();
      
      // ----- Error log
      c1::f4(d9, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the central directory informations
    $v40 = array();
    if (($v9 = $this->f11($v40)) != 1)
    {
      $this->f8();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Go to beginning of Central Dir
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v40['offset']."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
    if (@fseek($this->zip_fd, $v40['offset']))
    {
      $this->f8();

      // ----- Error log
      c1::f4(d21, 'Invalid archive size');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Read each entry
    for ($o=0; $o<$v40['entries']; $o++)
    {
      // ----- Read the file header
      if (($v9 = $this->f7($v25)) != 1)
      {
        $this->f8();
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
        return $v9;
      }
      $v25['index'] = $o;

      // ----- Get the only interesting attributes
      $this->f12($v25, $v20[$o]);
      unset($v25);
    }

    // ----- Close the zip file
    $this->f6();

    // ----- Magic quotes trick
    $this->f8();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f12()
  // Description :
  //   This function takes the file informations from the central directory
  //   entries and extract the interesting parameters that will be given back.
  //   The resulting file infos are set in the array $v45
  //     $v45['filename'] : Filename with full path. Given by user (add),
  //                           extracted in the filesystem (extract).
  //     $v45['stored_filename'] : Stored filename in the archive.
  //     $v45['size'] = Size of the file.
  //     $v45['compressed_size'] = Compressed size of the file.
  //     $v45['mtime'] = Last modification date of the file.
  //     $v45['comment'] = Comment associated with the file.
  //     $v45['folder'] = true/false : indicates if the entry is a folder or not.
  //     $v45['status'] = status of the action on the file.
  //     $v45['crc'] = CRC of the file content.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f12($v33, &$v45)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f12", "Filename='".$v33['filename']."'");
    $v9=1;

    // ----- Get the interesting attributes
    $v_temp_path = c1UtilPathReduction($v33['filename']);
    $v45['filename'] = $v_temp_path;
    $v_temp_path = c1UtilPathReduction($v33['stored_filename']);
    $v45['stored_filename'] = $v_temp_path;
    $v45['size'] = $v33['size'];
    $v45['compressed_size'] = $v33['compressed_size'];
    $v45['mtime'] = $v33['mtime'];
    $v45['comment'] = $v33['comment'];
    $v45['folder'] = (($v33['external']&0x00000010)==0x00000010);
    $v45['index'] = $v33['index'];
    $v45['status'] = $v33['status'];
    $v45['crc'] = $v33['crc'];

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privExtractByRule()
  // Description :
  //   Extract a file or directory depending of rules (by index, by name, ...)
  // Parameters :
  //   $v35_list : An array where will be placed the properties of each
  //                  extracted file
  //   $v27 : Path to add while writing the extracted files
  //   $p_remove_path : Path to remove (from the file memorized path) while writing the
  //                    extracted files. If the path does not match the file path,
  //                    the file is extracted with its memorized path.
  //                    $p_remove_path does not apply to 'list' mode.
  //                    $v27 and $p_remove_path are commulative.
  // Return Values :
  //   1 on success,0 or less on error (see error code list)
  // --------------------------------------------------------------------------------
  function privExtractByRule(&$v35_list, $v27, $p_remove_path, $p_remove_all_path, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privExtractByRule", "path='$v27', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
    $v9=1;

    // ----- Magic quotes trick
    $this->f14();

    // ----- Check the path
    if (   ($v27 == "")
	    || (   (substr($v27, 0, 1) != "/")
		    && (substr($v27, 0, 3) != "../")
			&& (substr($v27,1,2)!=":/")))
      $v27 = "./".$v27;

    // ----- Reduce the path last (and duplicated) '/'
    if (($v27 != "./") && ($v27 != "/"))
    {
      // ----- Look for the path end '/'
      while (substr($v27, -1) == "/")
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$v27] ends by '/'");
        $v27 = substr($v27, 0, strlen($v27)-1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$v27]");
      }
    }

    // ----- Look for path to remove format (should end by /)
    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
    {
      $p_remove_path .= '/';
    }
    $p_remove_path_size = strlen($p_remove_path);

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v9 = $this->privOpenFd('rb')) != 1)
    {
      $this->f8();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Read the central directory informations
    $v40 = array();
    if (($v9 = $this->f11($v40)) != 1)
    {
      // ----- Close the zip file
      $this->f6();
      $this->f8();

      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Start at beginning of Central Dir
    $v32_entry = $v40['offset'];

    // ----- Read each entry
    $h_start = 0;
    for ($o=0, $v51=0; $o<$v40['entries']; $o++)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$o'");

      // ----- Read next Central dir entry
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
      @rewind($this->zip_fd);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
      if (@fseek($this->zip_fd, $v32_entry))
      {
        // ----- Close the zip file
        $this->f6();
        $this->f8();

        // ----- Error log
        c1::f4(d21, 'Invalid archive size');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");

      // ----- Read the file header
      $v25 = array();
      if (($v9 = $this->f7($v25)) != 1)
      {
        // ----- Close the zip file
        $this->f6();
        $this->f8();

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
        return $v9;
      }

      // ----- Store the index
      $v25['index'] = $o;

      // ----- Store the file position
      $v32_entry = ftell($this->zip_fd);

      // ----- Look for the specific extract rules
      $v58 = false;

      // ----- Look for extract by name rule
      if (   (isset($v36[d36]))
          && ($v36[d36] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");

          // ----- Look if the filename is in the list
          for ($h=0; ($h<sizeof($v36[d36])) && (!$v58); $h++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$v36[d36][$h]."'");

              // ----- Look for a directory
              if (substr($v36[d36][$h], -1) == "/") {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");

                  // ----- Look if the directory is in the filename path
                  if (   (strlen($v25['stored_filename']) > strlen($v36[d36][$h]))
                      && (substr($v25['stored_filename'], 0, strlen($v36[d36][$h])) == $v36[d36][$h])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
                      $v58 = true;
                  }
              }
              // ----- Look for a filename
              elseif ($v25['stored_filename'] == $v36[d36][$h]) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
                  $v58 = true;
              }
          }
      }

      // ----- Look for extract by ereg rule
      else if (   (isset($v36[d38]))
               && ($v36[d38] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$v36[d38]."'");

          if (ereg($v36[d38], $v25['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v58 = true;
          }
      }

      // ----- Look for extract by preg rule
      else if (   (isset($v36[d39]))
               && ($v36[d39] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");

          if (preg_match($v36[d39], $v25['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v58 = true;
          }
      }

      // ----- Look for extract by index rule
      else if (   (isset($v36[d37]))
               && ($v36[d37] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
          
          // ----- Look if the index is in the list
          for ($h=$h_start; ($h<sizeof($v36[d37])) && (!$v58); $h++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$o' is in [".$v36[d37][$h]['start'].",".$v36[d37][$h]['end']."]");

              if (($o>=$v36[d37][$h]['start']) && ($o<=$v36[d37][$h]['end'])) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
                  $v58 = true;
              }
              if ($o>=$v36[d37][$h]['end']) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
                  $h_start = $h+1;
              }

              if ($v36[d37][$h]['start']>$o) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
                  break;
              }
          }
      }

      // ----- Look for no rule, which means extract all the archive
      else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
          $v58 = true;
      }

	  // ----- Check compression method
	  if (   ($v58)
	      && (   ($v25['compression'] != 8)
		      && ($v25['compression'] != 0))) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v25['compression'].")");
          $v25['status'] = 'unsupported_compression';

          // ----- Look for d45
          if (   (isset($v36[d45]))
		      && ($v36[d45]===true)) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d45 is selected, extraction will be stopped");

              $this->f8();
              
              c1::f4(d25,
			                       "Filename '".$v25['stored_filename']."' is "
				  	    	  	   ."compressed by an unsupported compression "
				  	    	  	   ."method (".$v25['compression'].") ");

              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
              return c1::f9();
		  }
	  }
	  
	  // ----- Check encrypted files
	  if (($v58) && (($v25['flag'] & 1) == 1)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
          $v25['status'] = 'unsupported_encryption';

          // ----- Look for d45
          if (   (isset($v36[d45]))
		      && ($v36[d45]===true)) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d45 is selected, extraction will be stopped");

              $this->f8();

              c1::f4(d26,
			                       "Unsupported encryption for "
				  	    	  	   ." filename '".$v25['stored_filename']
								   ."'");

              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
              return c1::f9();
		  }
    }

      // ----- Look for real extraction
      if (($v58) && ($v25['status'] != 'ok')) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
          $v9 = $this->f12($v25,
		                                        $v35_list[$v51++]);
          if ($v9 != 1) {
              $this->f6();
              $this->f8();
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
              return $v9;
          }

          $v58 = false;
      }
      
      // ----- Look for real extraction
      if ($v58)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v25['filename']."', index '$o'");

        // ----- Go to the file position
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
        @rewind($this->zip_fd);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
        if (@fseek($this->zip_fd, $v25['offset']))
        {
          // ----- Close the zip file
          $this->f6();

          $this->f8();

          // ----- Error log
          c1::f4(d21, 'Invalid archive size');

          // ----- Return
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
          return c1::f9();
        }
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

        // ----- Look for extraction as string
        if ($v36[d34]) {

          // ----- Extracting the file
          $v91 = $this->f5AsString($v25, $v17);
          if ($v91 < 1) {
            $this->f6();
            $this->f8();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v91);
            return $v91;
          }

          // ----- Get the only interesting attributes
          if (($v9 = $this->f12($v25, $v35_list[$v51])) != 1)
          {
            // ----- Close the zip file
            $this->f6();
            $this->f8();

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
          }

          // ----- Set the file content
          $v35_list[$v51]['content'] = $v17;

          // ----- Next extracted file
          $v51++;
          
          // ----- Look for user callback abort
          if ($v91 == 2) {
          	break;
          }
        }
        // ----- Look for extraction in standard output
        elseif (   (isset($v36[d43]))
		        && ($v36[d43])) {
          // ----- Extracting the file in standard output
          $v91 = $this->f5InOutput($v25, $v36);
          if ($v91 < 1) {
            $this->f6();
            $this->f8();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v91);
            return $v91;
          }

          // ----- Get the only interesting attributes
          if (($v9 = $this->f12($v25, $v35_list[$v51++])) != 1) {
            $this->f6();
            $this->f8();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
          }

          // ----- Look for user callback abort
          if ($v91 == 2) {
          	break;
          }
        }
        // ----- Look for normal extraction
        else {
          // ----- Extracting the file
          $v91 = $this->f5($v25,
		                                      $v27, $p_remove_path,
											  $p_remove_all_path,
											  $v36);
          if ($v91 < 1) {
            $this->f6();
            $this->f8();
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v91);
            return $v91;
          }

          // ----- Get the only interesting attributes
          if (($v9 = $this->f12($v25, $v35_list[$v51++])) != 1)
          {
            // ----- Close the zip file
            $this->f6();
            $this->f8();

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
          }

          // ----- Look for user callback abort
          if ($v91 == 2) {
          	break;
          }
        }
      }
    }

    // ----- Close the zip file
    $this->f6();
    $this->f8();

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f5()
  // Description :
  // Parameters :
  // Return Values :
  //
  // 1 : ... ?
  // d6(2) : User ask for extraction stop in callback
  // --------------------------------------------------------------------------------
  function f5(&$v28, $v27, $p_remove_path, $p_remove_all_path, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f5', "path='$v27', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
    $v9=1;

    // ----- Read the file header
    if (($v9 = $this->f1($v25)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v25['filename']."', size '".$v25['size']."'");

    // ----- Check that the file header is coherent with $v28 info
    if ($this->f10($v25, $v28) != 1) {
        // TBC
    }

    // ----- Look for all path to remove
    if ($p_remove_all_path == true) {
        // ----- Look for folder entry that not need to be extracted
        if (($v28['external']&0x00000010)==0x00000010) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");

            $v28['status'] = "filtered";

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
        // ----- Get the basename of the path
        $v28['filename'] = basename($v28['filename']);
    }

    // ----- Look for path to remove
    else if ($p_remove_path != "")
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
      if (c1UtilPathInclusion($p_remove_path, $v28['filename']) == 2)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$v28['filename']."'");

        // ----- Change the file status
        $v28['status'] = "filtered";

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
        return $v9;
      }

      $p_remove_path_size = strlen($p_remove_path);
      if (substr($v28['filename'], 0, $p_remove_path_size) == $p_remove_path)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$v28['filename']."'");

        // ----- Remove the path
        $v28['filename'] = substr($v28['filename'], $p_remove_path_size);

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$v28['filename']."'");
      }
    }

    // ----- Add the path
    if ($v27 != '') {
      $v28['filename'] = $v27."/".$v28['filename'];
    }
    
    // ----- Check a base_dir_restriction
    if (isset($v36[ddd45])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
      $v_inclusion
      = c1UtilPathInclusion($v36[ddd45],
                                $v28['filename']); 
      if ($v_inclusion == 0) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "ddd45 is selected, file is outside restriction");

        c1::f4(d28,
			                     "Filename '".$v28['filename']."' is "
								 ."outside ddd45");

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }
    }

    // ----- Look for pre-extract callback
    if (isset($v36[d58])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$v36[d58]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v28, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d58].'(d58, $v61);');
      if ($v9 == 0) {
        // ----- Change the file status
        $v28['status'] = "skipped";
        $v9 = 1;
      }
      
      // ----- Look for abort result
      if ($v9 == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
        // ----- This status is internal and will be changed in 'skipped'
        $v28['status'] = "aborted";
      	$v9 = d6;
      }

      // ----- Update the informations
      // Only some fields can be modified
      $v28['filename'] = $v61['filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$v28['filename']."'");
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$v28['filename']."', size '$v25[size]'");

    // ----- Look if extraction should be done
    if ($v28['status'] == 'ok') {

    // ----- Look for specific actions while the file exist
    if (file_exists($v28['filename']))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v28['filename']."' already exists");

      // ----- Look if file is a directory
      if (is_dir($v28['filename']))
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$v28['filename']."' is a directory");

        // ----- Change the file status
        $v28['status'] = "already_a_directory";
        
        // ----- Look for d45
        // For historical reason first c1 implementation does not stop
        // when this kind of error occurs.
        if (   (isset($v36[d45]))
		    && ($v36[d45]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d45 is selected, extraction will be stopped");

            c1::f4(d24,
			                     "Filename '".$v28['filename']."' is "
								 ."already used by an existing directory");

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
		    }
      }
      // ----- Look if file is write protected
      else if (!is_writeable($v28['filename']))
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$v28['filename']."' is write protected");

        // ----- Change the file status
        $v28['status'] = "write_protected";

        // ----- Look for d45
        // For historical reason first c1 implementation does not stop
        // when this kind of error occurs.
        if (   (isset($v36[d45]))
		    && ($v36[d45]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d45 is selected, extraction will be stopped");

            c1::f4(d8,
			                     "Filename '".$v28['filename']."' exists "
								 ."and is write protected");

            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
		    }
      }

      // ----- Look if the extracted file is older
      else if (filemtime($v28['filename']) > $v28['mtime'])
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$v28['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($v28['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $v28['mtime']).")");
        // ----- Change the file status
        if (   (isset($v36[d44]))
		    && ($v36[d44]===true)) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d44 is selected, file will be replaced");
	  	  }
		    else {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
            $v28['status'] = "newer_exist";

            // ----- Look for d45
            // For historical reason first c1 implementation does not stop
            // when this kind of error occurs.
            if (   (isset($v36[d45]))
		        && ($v36[d45]===true)) {
                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "d45 is selected, extraction will be stopped");

                c1::f4(d8,
			             "Newer version of '".$v28['filename']."' exists "
					    ."and option d44 is not selected");

                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
                return c1::f9();
		      }
		    }
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$v28['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($v28['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $v28['mtime']).")");
      }
    }

    // ----- Check the directory availability and create it if necessary
    else {
      if ((($v28['external']&0x00000010)==0x00000010) || (substr($v28['filename'], -1) == '/'))
        $v29 = $v28['filename'];
      else if (!strstr($v28['filename'], "/"))
        $v29 = "";
      else
        $v29 = dirname($v28['filename']);

        if (($v9 = $this->f16($v29, (($v28['external']&0x00000010)==0x00000010))) != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$v28['filename']."'");
  
          // ----- Change the file status
          $v28['status'] = "path_creation_fail";
  
          // ----- Return
          ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          //return $v9;
          $v9 = 1;
        }
      }
    }

    // ----- Look if extraction should be done
    if ($v28['status'] == 'ok') {

      // ----- Do the extraction (if not a folder)
      if (!(($v28['external']&0x00000010)==0x00000010))
      {
        // ----- Look for not compressed file
        if ($v28['compression'] == 0) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");

    		  // ----- Opening destination file
          if (($v59 = @fopen($v28['filename'], 'wb')) == 0)
          {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$v28['filename']."' in write binary mode");

            // ----- Change the file status
            $v28['status'] = "write_error";

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
          }

          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$v28['size']."' bytes");

          // ----- Read the file by d1 octets blocks
          $v8 = $v28['compressed_size'];
          while ($v8 != 0)
          {
            $v57 = ($v8 < d1 ? $v8 : d1);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v57 bytes");
            $v37 = @fread($this->zip_fd, $v57);
            /* Try to speed up the code
            $v47 = pack('a'.$v57, $v37);
            @fwrite($v59, $v47, $v57);
            */
            @fwrite($v59, $v37, $v57);            
            $v8 -= $v57;
          }

          // ----- Closing the destination file
          fclose($v59);

          // ----- Change the file mtime
          touch($v28['filename'], $v28['mtime']);
          

        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$v28['compression'].")");
          // ----- TBC
          // Need to be finished
          if (($v28['flag'] & 1) == 1) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
            c1::f4(d26, 'File \''.$v28['filename'].'\' is encrypted. Encrypted files are not supported.');
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
            return c1::f9();
          }


          // ----- Look for using temporary file to unzip
          if ( (!isset($v36[d50])) 
              && (isset($v36[ddd48])
                  || (isset($v36[ddd46])
                      && ($v36[ddd46] <= $v28['size'])) ) ) {
            $v9 = $this->f5UsingTempFile($v28, $v36);
            if ($v9 < d7) {
              return $v9;
            }
          }
          
          // ----- Look for extract in memory
          else {

            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$v28['compressed_size']."' compressed bytes");
          
            // ----- Read the compressed file in a buffer (one shot)
            $v37 = @fread($this->zip_fd, $v28['compressed_size']);
            
            // ----- Decompress the file
            $v30 = @gzinflate($v37);
            unset($v37);
            if ($v30 === FALSE) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
  
              // ----- Change the file status
              // TBC
              $v28['status'] = "error";
              
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
              return $v9;
            }
            
            // ----- Opening destination file
            if (($v59 = @fopen($v28['filename'], 'wb')) == 0) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$v28['filename']."' in write binary mode");
  
              // ----- Change the file status
              $v28['status'] = "write_error";
  
              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
              return $v9;
            }
  
            // ----- Write the uncompressed data
            @fwrite($v59, $v30, $v28['size']);
            unset($v30);
  
            // ----- Closing the destination file
            @fclose($v59);
            
          }

          // ----- Change the file mtime
          @touch($v28['filename'], $v28['mtime']);
        }

        // ----- Look for chmod option
        if (isset($v36[d33])) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$v36[d33]."'");

          // ----- Change the mode of the file
          @chmod($v28['filename'], $v36[d33]);
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
      }
    }

	// ----- Change abort status
	if ($v28['status'] == "aborted") {
      $v28['status'] = "skipped";
	}
	
    // ----- Look for post-extract callback
    elseif (isset($v36[d59])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$v36[d59]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v28, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d59].'(d59, $v61);');

      // ----- Look for abort result
      if ($v9 == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
      	$v9 = d6;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f5UsingTempFile()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f5UsingTempFile(&$v28, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f5UsingTempFile', "filename='".$v28['filename']."'");
    $v9=1;
        
    // ----- Creates a temporary file
    $v46 = d4.uniqid('c1-').'.gz';
    if (($v59 = @fopen($v46, "wb")) == 0) {
      fclose($v34);
      c1::f4(d8, 'Unable to open temporary file \''.$v46.'\' in binary write mode');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Start extraction of '".$v28['filename']."'");

    // ----- Write gz file format header
    $v47 = pack('va1a1Va1a1', 0x8b1f, Chr($v28['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
    @fwrite($v59, $v47, 10);

    // ----- Read the file by d1 octets blocks
    $v8 = $v28['compressed_size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Compressed Size :".$v8."");
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v57." bytes");
      $v37 = @fread($this->zip_fd, $v57);
      //$v47 = pack('a'.$v57, $v37);
      @fwrite($v59, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Write gz file format footer
    $v47 = pack('VV', $v28['crc'], $v28['size']);
    @fwrite($v59, $v47, 8);

    // ----- Close the temporary file
    @fclose($v59);

    // ----- Opening destination file
    if (($v59 = @fopen($v28['filename'], 'wb')) == 0) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$v28['filename']."' in write binary mode");
      $v28['status'] = "write_error";
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Open the temporary gz file
    if (($v64 = @gzopen($v46, 'rb')) == 0) {
      @fclose($v59);
      $v28['status'] = "read_error";
      c1::f4(d9, 'Unable to open temporary file \''.$v46.'\' in binary read mode');
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File size is '.filesize($v46));
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$v28['size']."' bytes");

    // ----- Read the file by d1 octets blocks
    $v8 = $v28['size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size :".$v8."");
    while ($v8 != 0) {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v57." bytes");
      $v37 = @gzread($v64, $v57);
      //$v47 = pack('a'.$v57, $v37);
      @fwrite($v59, $v37, $v57);
      $v8 -= $v57;
    }
    @fclose($v59);
    @gzclose($v64);

    // ----- Delete the temporary file
    @unlink($v46);
    
    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f5InOutput()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f5InOutput(&$v28, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f5InOutput', "");
    $v9=1;

    // ----- Read the file header
    if (($v9 = $this->f1($v25)) != 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v25['filename']."', size '".$v25['size']."'");

    // ----- Check that the file header is coherent with $v28 info
    if ($this->f10($v25, $v28) != 1) {
        // TBC
    }

    // ----- Look for pre-extract callback
    if (isset($v36[d58])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$v36[d58]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v28, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d58].'(d58, $v61);');
      if ($v9 == 0) {
        // ----- Change the file status
        $v28['status'] = "skipped";
        $v9 = 1;
      }

      // ----- Look for abort result
      if ($v9 == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
        // ----- This status is internal and will be changed in 'skipped'
        $v28['status'] = "aborted";
      	$v9 = d6;
      }

      // ----- Update the informations
      // Only some fields can be modified
      $v28['filename'] = $v61['filename'];
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$v28['filename']."'");
    }

    // ----- Trace
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$v28['filename']."', size '$v25[size]'");

    // ----- Look if extraction should be done
    if ($v28['status'] == 'ok') {

      // ----- Do the extraction (if not a folder)
      if (!(($v28['external']&0x00000010)==0x00000010)) {
        // ----- Look for not compressed file
        if ($v28['compressed_size'] == $v28['size']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$v28['size']."' bytes");

          // ----- Read the file in a buffer (one shot)
          $v37 = @fread($this->zip_fd, $v28['compressed_size']);

          // ----- Send the file to the output
          echo $v37;
          unset($v37);
        }
        else {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$v28['size']."' bytes");

          // ----- Read the compressed file in a buffer (one shot)
          $v37 = @fread($this->zip_fd, $v28['compressed_size']);
          
          // ----- Decompress the file
          $v30 = gzinflate($v37);
          unset($v37);

          // ----- Send the file to the output
          echo $v30;
          unset($v30);
        }
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
      }
    }

	// ----- Change abort status
	if ($v28['status'] == "aborted") {
      $v28['status'] = "skipped";
	}

    // ----- Look for post-extract callback
    elseif (isset($v36[d59])) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$v36[d59]."()') is defined for the extraction");

      // ----- Generate a local information
      $v61 = array();
      $this->f12($v28, $v61);

      // ----- Call the callback
      // Here I do not use call_user_func() because I need to send a reference to the
      // header.
      eval('$v9 = '.$v36[d59].'(d59, $v61);');

      // ----- Look for abort result
      if ($v9 == 2) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
      	$v9 = d6;
      }
    }

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f5AsString()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f5AsString(&$v28, &$v31)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f5AsString', "p_entry['filename']='".$v28['filename']."'");
    $v9=1;

    // ----- Read the file header
    $v25 = array();
    if (($v9 = $this->f1($v25)) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v25['filename']."', size '".$v25['size']."'");

    // ----- Check that the file header is coherent with $v28 info
    if ($this->f10($v25, $v28) != 1) {
        // TBC
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$v28['filename']."', size '$v25[size]'");

    // ----- Do the extraction (if not a folder)
    if (!(($v28['external']&0x00000010)==0x00000010))
    {
      // ----- Look for not compressed file
//      if ($v28['compressed_size'] == $v28['size'])
      if ($v28['compression'] == 0) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$v28['size']."' bytes");

        // ----- Reading the file
        $v31 = @fread($this->zip_fd, $v28['compressed_size']);
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$v28['compression']."')");

        // ----- Reading the file
        $v26 = @fread($this->zip_fd, $v28['compressed_size']);
        
        // ----- Decompress the file
        if (($v31 = @gzinflate($v26)) === FALSE) {
            // TBC
        }
      }

      // ----- Trace
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
    }
    else {
        // TBC : error : can not extract a folder in a string
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f1()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f1(&$v33)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f1", "");
    $v9=1;

    // ----- Read the 4 bytes signature
    $v47 = @fread($this->zip_fd, 4);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v47)."'");
    $v26 = unpack('Vid', $v47);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v26['id'])."'");

    // ----- Check signature
    if ($v26['id'] != 0x04034b50)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");

      // ----- Error log
      c1::f4(d17, 'Invalid archive structure');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the first 42 bytes of the header
    $v47 = fread($this->zip_fd, 26);

    // ----- Look for invalid block size
    if (strlen($v47) != 26)
    {
      $v33['filename'] = "";
      $v33['status'] = "invalid_header";
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v47));

      // ----- Error log
      c1::f4(d17, "Invalid block size : ".strlen($v47));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Extract the values
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v47."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v47)."'");
    $v26 = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v47);

    // ----- Get filename
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v26['filename_len']);
    $v33['filename'] = fread($this->zip_fd, $v26['filename_len']);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$v33['filename'].'\'');

    // ----- Get extra_fields
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v26['extra_len']);
    if ($v26['extra_len'] != 0) {
      $v33['extra'] = fread($this->zip_fd, $v26['extra_len']);
    }
    else {
      $v33['extra'] = '';
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($v33['extra']).'\'');

    // ----- Extract properties
    $v33['version_extracted'] = $v26['version'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$v33['version_extracted'].') \''.($v33['version_extracted']/10).'.'.($v33['version_extracted']%10).'\'');
    $v33['compression'] = $v26['compression'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$v33['compression'].'\'');
    $v33['size'] = $v26['size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$v33['size'].'\'');
    $v33['compressed_size'] = $v26['compressed_size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$v33['compressed_size'].'\'');
    $v33['crc'] = $v26['crc'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $v33['crc']).'\'');
    $v33['flag'] = $v26['flag'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$v33['flag'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from right) : \''.($v33['flag']&0x0400).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from left) : \''.($v33['flag']&0x0020).'\'');
    $v33['filename_len'] = $v26['filename_len'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$v33['filename_len'].'\'');

    // ----- Recuperate date in UNIX format
    $v33['mdate'] = $v26['mdate'];
    $v33['mtime'] = $v26['mtime'];
    if ($v33['mdate'] && $v33['mtime'])
    {
      // ----- Extract time
      $v_hour = ($v33['mtime'] & 0xF800) >> 11;
      $v_minute = ($v33['mtime'] & 0x07E0) >> 5;
      $v_seconde = ($v33['mtime'] & 0x001F)*2;

      // ----- Extract date
      $v_year = (($v33['mdate'] & 0xFE00) >> 9) + 1980;
      $v_month = ($v33['mdate'] & 0x01E0) >> 5;
      $v_day = $v33['mdate'] & 0x001F;

      // ----- Get UNIX date format
      $v33['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    }
    else
    {
      $v33['mtime'] = time();
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    }

    // TBC
    //for(reset($v26); $key = key($v26); next($v26)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v26[$key]);
    //}

    // ----- Set the stored filename
    $v33['stored_filename'] = $v33['filename'];

    // ----- Set the status field
    $v33['status'] = "ok";

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f7()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f7(&$v33)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f7", "");
    $v9=1;

    // ----- Read the 4 bytes signature
    $v47 = @fread($this->zip_fd, 4);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v47)."'");
    $v26 = unpack('Vid', $v47);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v26['id'])."'");

    // ----- Check signature
    if ($v26['id'] != 0x02014b50)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");

      // ----- Error log
      c1::f4(d17, 'Invalid archive structure');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Read the first 42 bytes of the header
    $v47 = fread($this->zip_fd, 42);

    // ----- Look for invalid block size
    if (strlen($v47) != 42)
    {
      $v33['filename'] = "";
      $v33['status'] = "invalid_header";
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v47));

      // ----- Error log
      c1::f4(d17, "Invalid block size : ".strlen($v47));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Extract the values
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v47."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v47)."'");
    $v33 = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v47);

    // ----- Get filename
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$v33['filename_len']);
    if ($v33['filename_len'] != 0)
      $v33['filename'] = fread($this->zip_fd, $v33['filename_len']);
    else
      $v33['filename'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$v33['filename'].'\'');

    // ----- Get extra
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$v33['extra_len']);
    if ($v33['extra_len'] != 0)
      $v33['extra'] = fread($this->zip_fd, $v33['extra_len']);
    else
      $v33['extra'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$v33['extra'].'\'');

    // ----- Get comment
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$v33['comment_len']);
    if ($v33['comment_len'] != 0)
      $v33['comment'] = fread($this->zip_fd, $v33['comment_len']);
    else
      $v33['comment'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$v33['comment'].'\'');

    // ----- Extract properties
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($v33['version']/10).'.'.($v33['version']%10).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($v33['version_extracted']/10).'.'.($v33['version_extracted']%10).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$v33['size'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$v33['compressed_size'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $v33['crc']).'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$v33['flag'].'\'');
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$v33['offset'].'\'');

    // ----- Recuperate date in UNIX format
    //if ($v33['mdate'] && $v33['mtime'])
    // TBC : bug : this was ignoring time with 0/0/0
    if (1)
    {
      // ----- Extract time
      $v_hour = ($v33['mtime'] & 0xF800) >> 11;
      $v_minute = ($v33['mtime'] & 0x07E0) >> 5;
      $v_seconde = ($v33['mtime'] & 0x001F)*2;

      // ----- Extract date
      $v_year = (($v33['mdate'] & 0xFE00) >> 9) + 1980;
      $v_month = ($v33['mdate'] & 0x01E0) >> 5;
      $v_day = $v33['mdate'] & 0x001F;

      // ----- Get UNIX date format
      $v33['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    }
    else
    {
      $v33['mtime'] = time();
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $v33['mtime']).'\'');
    }

    // ----- Set the stored filename
    $v33['stored_filename'] = $v33['filename'];

    // ----- Set default status to ok
    $v33['status'] = 'ok';

    // ----- Look if it is a directory
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $v33['internal'])."'");
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $v33['external'])."' (".(($v33['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
    if (substr($v33['filename'], -1) == '/') {
      //$v33['external'] = 0x41FF0010;
      $v33['external'] = 0x00000010;
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $v33['external']).'\'');
    }

    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$v33['filename'].'\'');

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f10()
  // Description :
  // Parameters :
  // Return Values :
  //   1 on success,
  //   0 on error;
  // --------------------------------------------------------------------------------
  function f10(&$v48, &$v67)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f10", "");
    $v9=1;

  	// ----- Check the static values
  	// TBC
  	if ($v48['filename'] != $v67['filename']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
  	}
  	if ($v48['version_extracted'] != $v67['version_extracted']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
  	}
  	if ($v48['flag'] != $v67['flag']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
  	}
  	if ($v48['compression'] != $v67['compression']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
  	}
  	if ($v48['mtime'] != $v67['mtime']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
  	}
  	if ($v48['filename_len'] != $v67['filename_len']) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
  	}
  
  	// ----- Look for flag bit 3
  	if (($v48['flag'] & 8) == 8) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
          $v48['size'] = $v67['size'];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$v48['size'].'\'');
          $v48['compressed_size'] = $v67['compressed_size'];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$v48['compressed_size'].'\'');
          $v48['crc'] = $v67['crc'];
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $v48['crc']).'\'');
  	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f11()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f11(&$v41)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f11", "");
    $v9=1;

    // ----- Go to the end of the zip file
    $v8 = filesize($this->zipname);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v8");
    @fseek($this->zip_fd, $v8);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
    if (@ftell($this->zip_fd) != $v8)
    {
      // ----- Error log
      c1::f4(d17, 'Unable to go to the end of the archive \''.$this->zipname.'\'');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- First try : look if this is an archive with no commentaries (most of the time)
    // in this case the end of central dir is at 22 bytes of the file end
    $v49 = 0;
    if ($v8 > 26) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
      @fseek($this->zip_fd, $v8-22);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
      if (($v32 = @ftell($this->zip_fd)) != ($v8-22))
      {
        // ----- Error log
        c1::f4(d17, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }

      // ----- Read for bytes
      $v47 = @fread($this->zip_fd, 4);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v47)."'");
      $v26 = @unpack('Vid', $v47);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v26['id'])."'");

      // ----- Check signature
      if ($v26['id'] == 0x06054b50) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
        $v49 = 1;
      }

      $v32 = ftell($this->zip_fd);
    }

    // ----- Go back to the maximum possible size of the Central Dir End Record
    if (!$v49) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
      $v66 = 65557; // 0xFFFF + 22;
      if ($v66 > $v8)
        $v66 = $v8;
      @fseek($this->zip_fd, $v8-$v66);
      if (@ftell($this->zip_fd) != ($v8-$v66))
      {
        // ----- Error log
        c1::f4(d17, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');

      // ----- Read byte per byte in order to find the signature
      $v32 = ftell($this->zip_fd);
      $v68 = 0x00000000;
      while ($v32 < $v8)
      {
        // ----- Read a byte
        $v_byte = @fread($this->zip_fd, 1);

        // -----  Add the byte
        $v68 = ($v68 << 8) | Ord($v_byte);

        // ----- Compare the bytes
        if ($v68 == 0x504b0506)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
          $v32++;
          break;
        }

        $v32++;
      }

      // ----- Look if not found end of central dir
      if ($v32 == $v8)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");

        // ----- Error log
        c1::f4(d17, "Unable to find End of Central Dir Record signature");

        // ----- Return
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
        return c1::f9();
      }
    }

    // ----- Read the first 18 bytes of the header
    $v47 = fread($this->zip_fd, 18);

    // ----- Look for invalid block size
    if (strlen($v47) != 18)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v47));

      // ----- Error log
      c1::f4(d17, "Invalid End of Central Dir Record size : ".strlen($v47));

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Extract the values
    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v47."'");
    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v47)."'");
    $v26 = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v47);

    // ----- Check the global size
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v26['comment_size']);
    if (($v32 + $v26['comment_size'] + 18) != $v8) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");

	  // ----- Removed in release 2.2 see readme file
	  // The check of the file size is a little too strict.
	  // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
	  // While decrypted, zip has training 0 bytes
	  if (0) {
      // ----- Error log
      c1::f4(d17,
	                       'The central dir is not at the end of the archive.'
						   .' Some trailing bytes exists after the archive.');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
	  }
    }

    // ----- Get comment
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$v26['comment_size'].'\'');
    if ($v26['comment_size'] != 0) {
      $v41['comment'] = fread($this->zip_fd, $v26['comment_size']);
    }
    else
      $v41['comment'] = '';
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$v41['comment'].'\'');

    $v41['entries'] = $v26['entries'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$v41['entries'].'\'');
    $v41['disk_entries'] = $v26['disk_entries'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$v41['disk_entries'].'\'');
    $v41['offset'] = $v26['offset'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$v41['offset'].'\'');
    $v41['size'] = $v26['size'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$v41['size'].'\'');
    $v41['disk'] = $v26['disk'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$v41['disk'].'\'');
    $v41['disk_start'] = $v26['disk_start'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$v41['disk_start'].'\'');

    // TBC
    //for(reset($v41); $key = key($v41); next($v41)) {
    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$v41[$key]);
    //}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDeleteByRule()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDeleteByRule(&$v13, &$v36)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privDeleteByRule", "");
    $v9=1;
    $v24_detail = array();

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v9=$this->privOpenFd('rb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Read the central directory informations
    $v40 = array();
    if (($v9 = $this->f11($v40)) != 1)
    {
      $this->f6();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");

    // ----- Scan all the files
    // ----- Start at beginning of Central Dir
    $v32_entry = $v40['offset'];
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
    if (@fseek($this->zip_fd, $v32_entry))
    {
      // ----- Close the zip file
      $this->f6();

      // ----- Error log
      c1::f4(d21, 'Invalid archive size');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

    // ----- Read each entry
    $v25_list = array();
    $h_start = 0;
    for ($o=0, $v51=0; $o<$v40['entries']; $o++)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$o')");

      // ----- Read the file header
      $v25_list[$v51] = array();
      if (($v9 = $this->f7($v25_list[$v51])) != 1)
      {
        // ----- Close the zip file
        $this->f6();

        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
        return $v9;
      }

      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$o') : '".$v25_list[$v51]['stored_filename']."'");

      // ----- Store the index
      $v25_list[$v51]['index'] = $o;

      // ----- Look for the specific extract rules
      $v49 = false;

      // ----- Look for extract by name rule
      if (   (isset($v36[d36]))
          && ($v36[d36] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");

          // ----- Look if the filename is in the list
          for ($h=0; ($h<sizeof($v36[d36])) && (!$v49); $h++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$v36[d36][$h]."'");

              // ----- Look for a directory
              if (substr($v36[d36][$h], -1) == "/") {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");

                  // ----- Look if the directory is in the filename path
                  if (   (strlen($v25_list[$v51]['stored_filename']) > strlen($v36[d36][$h]))
                      && (substr($v25_list[$v51]['stored_filename'], 0, strlen($v36[d36][$h])) == $v36[d36][$h])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
                      $v49 = true;
                  }
                  elseif (   (($v25_list[$v51]['external']&0x00000010)==0x00000010) /* Indicates a folder */
                          && ($v25_list[$v51]['stored_filename'].'/' == $v36[d36][$h])) {
                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
                      $v49 = true;
                  }
              }
              // ----- Look for a filename
              elseif ($v25_list[$v51]['stored_filename'] == $v36[d36][$h]) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
                  $v49 = true;
              }
          }
      }

      // ----- Look for extract by ereg rule
      else if (   (isset($v36[d38]))
               && ($v36[d38] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$v36[d38]."'");

          if (ereg($v36[d38], $v25_list[$v51]['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v49 = true;
          }
      }

      // ----- Look for extract by preg rule
      else if (   (isset($v36[d39]))
               && ($v36[d39] != "")) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");

          if (preg_match($v36[d39], $v25_list[$v51]['stored_filename'])) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
              $v49 = true;
          }
      }

      // ----- Look for extract by index rule
      else if (   (isset($v36[d37]))
               && ($v36[d37] != 0)) {
          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");

          // ----- Look if the index is in the list
          for ($h=$h_start; ($h<sizeof($v36[d37])) && (!$v49); $h++) {
              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$o' is in [".$v36[d37][$h]['start'].",".$v36[d37][$h]['end']."]");

              if (($o>=$v36[d37][$h]['start']) && ($o<=$v36[d37][$h]['end'])) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
                  $v49 = true;
              }
              if ($o>=$v36[d37][$h]['end']) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
                  $h_start = $h+1;
              }

              if ($v36[d37][$h]['start']>$o) {
                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
                  break;
              }
          }
      }
      else {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
      	$v49 = true;
      }

      // ----- Look for deletion
      if ($v49)
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v25_list[$v51]['stored_filename']."', index '$o' need to be deleted");
        unset($v25_list[$v51]);
      }
      else
      {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v25_list[$v51]['stored_filename']."', index '$o' will not be deleted");
        $v51++;
      }
    }

    // ----- Look if something need to be deleted
    if ($v51 > 0) {

        // ----- Creates a temporay file
        $v_zip_temp_name = d4.uniqid('c1-').'.tmp';

        // ----- Creates a temporary zip archive
        $v69 = new c1($v_zip_temp_name);

        // ----- Open the temporary zip file in write mode
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
        if (($v9 = $v69->privOpenFd('wb')) != 1) {
            $this->f6();

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
        }

        // ----- Look which file need to be kept
        for ($o=0; $o<sizeof($v25_list); $o++) {
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$o' : '".$v25_list[$o]['filename']."'");

            // ----- Calculate the position of the header
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v25_list[$o]['offset']."'");
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
            @rewind($this->zip_fd);
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
            if (@fseek($this->zip_fd,  $v25_list[$o]['offset'])) {
                // ----- Close the zip file
                $this->f6();
                $v69->f6();
                @unlink($v_zip_temp_name);

                // ----- Error log
                c1::f4(d21, 'Invalid archive size');

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
                return c1::f9();
            }
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");

            // ----- Read the file header
            $v61 = array();
            if (($v9 = $this->f1($v61)) != 1) {
                // ----- Close the zip file
                $this->f6();
                $v69->f6();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
                return $v9;
            }
            
            // ----- Check that local file header is same as central file header
            if ($this->f10($v61,
			                                $v25_list[$o]) != 1) {
                // TBC
            }
            unset($v61);

            // ----- Write the file header
            if (($v9 = $v69->privWriteFileHeader($v25_list[$o])) != 1) {
                // ----- Close the zip file
                $this->f6();
                $v69->f6();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
                return $v9;
            }
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v25_list[$o]['offset']."'");

            // ----- Read/write the data block
            if (($v9 = c1UtilCopyBlock($this->zip_fd, $v69->zip_fd, $v25_list[$o]['compressed_size'])) != 1) {
                // ----- Close the zip file
                $this->f6();
                $v69->f6();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
                return $v9;
            }
        }

        // ----- Store the offset of the central dir
        $v52 = @ftell($v69->zip_fd);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v52");

        // ----- Re-Create the Central Dir files header
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
        for ($o=0; $o<sizeof($v25_list); $o++) {
            // ----- Create the file header
            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v25_list[$o]['offset']);
            if (($v9 = $v69->privWriteCentralFileHeader($v25_list[$o])) != 1) {
                $v69->f6();
                $this->f6();
                @unlink($v_zip_temp_name);

                // ----- Return
                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
                return $v9;
            }

            // ----- Transform the header to a 'usable' info
            $v69->f12($v25_list[$o], $v13[$o]);
        }

        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");

        // ----- Zip file comment
        $v53 = '';
        if (isset($v36[d40])) {
          $v53 = $v36[d40];
        }

        // ----- Calculate the size of the central header
        $v8 = @ftell($v69->zip_fd)-$v52;

        // ----- Create the central dir footer
        if (($v9 = $v69->f17(sizeof($v25_list), $v8, $v52, $v53)) != 1) {
            // ----- Reset the file list
            unset($v25_list);
            $v69->f6();
            $this->f6();
            @unlink($v_zip_temp_name);

            // ----- Return
            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
            return $v9;
        }

        // ----- Close
        $v69->f6();
        $this->f6();

        // ----- Delete the zip file
        // TBC : I should test the result ...
        @unlink($this->zipname);

        // ----- Rename the temporary file
        // TBC : I should test the result ...
        //@rename($v_zip_temp_name, $this->zipname);
        c1UtilRename($v_zip_temp_name, $this->zipname);
    
        // ----- Destroy the temporary archive
        unset($v69);
    }
    
    // ----- Remove every files : reset the file
    else if ($v40['entries'] != 0) {
        $this->f6();

        if (($v9 = $this->privOpenFd('wb')) != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }

        if (($v9 = $this->f17(0, 0, 0, '')) != 1) {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }

        $this->f6();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f16()
  // Description :
  //   Check if a directory exists, if not it creates it and all the parents directory
  //   which may be useful.
  // Parameters :
  //   $p_dir : Directory path to check.
  // Return Values :
  //    1 : OK
  //   -1 : Unable to create directory
  // --------------------------------------------------------------------------------
  function f16($p_dir, $p_is_dir=false)
  {
    $v9 = 1;

    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::f16", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");

    // ----- Remove the final '/'
    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
    {
      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
    }
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");

    // ----- Check the directory availability
    if ((is_dir($p_dir)) || ($p_dir == ""))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
      return 1;
    }

    // ----- Extract parent directory
    $p_parent_dir = dirname($p_dir);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");

    // ----- Just a check
    if ($p_parent_dir != $p_dir)
    {
      // ----- Look for parent directory
      if ($p_parent_dir != "")
      {
        if (($v9 = $this->f16($p_parent_dir)) != 1)
        {
          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
          return $v9;
        }
      }
    }

    // ----- Create the directory
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
    if (!@mkdir($p_dir, 0777))
    {
      // ----- Error log
      c1::f4(d15, "Unable to create directory '$p_dir'");

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9, "Directory '$p_dir' created");
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privMerge()
  // Description :
  //   If $v39_to_add does not exist, the function exit with a success result.
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privMerge(&$v39_to_add)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privMerge", "archive='".$v39_to_add->zipname."'");
    $v9=1;

    // ----- Look if the archive_to_add exists
    if (!is_file($v39_to_add->zipname))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");

      // ----- Nothing to merge, so merge is a success
      $v9 = 1;

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Look if the archive exists
    if (!is_file($this->zipname))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");

      // ----- Do a duplicate
      $v9 = $this->privDuplicate($v39_to_add->zipname);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v9=$this->privOpenFd('rb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Read the central directory informations
    $v40 = array();
    if (($v9 = $this->f11($v40)) != 1)
    {
      $this->f6();
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
    @rewind($this->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");

    // ----- Open the archive_to_add file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
    if (($v9=$v39_to_add->privOpenFd('rb')) != 1)
    {
      $this->f6();

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Read the central directory informations
    $v40_to_add = array();
    if (($v9 = $v39_to_add->f11($v40_to_add)) != 1)
    {
      $this->f6();
      $v39_to_add->f6();

      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Go to beginning of File
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($v39_to_add->zip_fd)."'");
    @rewind($v39_to_add->zip_fd);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($v39_to_add->zip_fd)."'");

    // ----- Creates a temporay file
    $v_zip_temp_name = d4.uniqid('c1-').'.tmp';

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v50 = @fopen($v_zip_temp_name, 'wb')) == 0)
    {
      $this->f6();
      $v39_to_add->f6();

      c1::f4(d9, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v8 = $v40['offset'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = fread($this->zip_fd, $v57);
      @fwrite($v50, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Copy the files from the archive_to_add into the temporary file
    $v8 = $v40_to_add['offset'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = fread($v39_to_add->zip_fd, $v57);
      @fwrite($v50, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Store the offset of the central dir
    $v52 = @ftell($v50);
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v52");

    // ----- Copy the block of file headers from the old archive
    $v8 = $v40['size'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = @fread($this->zip_fd, $v57);
      @fwrite($v50, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Copy the block of file headers from the archive_to_add
    $v8 = $v40_to_add['size'];
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
      $v37 = @fread($v39_to_add->zip_fd, $v57);
      @fwrite($v50, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Merge the file comments
    $v53 = $v40['comment'].' '.$v40_to_add['comment'];

    // ----- Calculate the size of the (new) central header
    $v8 = @ftell($v50)-$v52;

    // ----- Swap the file descriptor
    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
    // the following methods on the temporary fil and not the real archive fd
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v50;
    $v50 = $v_swap;

    // ----- Create the central dir footer
    if (($v9 = $this->f17($v40['entries']+$v40_to_add['entries'], $v8, $v52, $v53)) != 1)
    {
      $this->f6();
      $v39_to_add->f6();
      @fclose($v50);
      $this->zip_fd = null;

      // ----- Reset the file list
      unset($v25_list);

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Swap back the file descriptor
    $v_swap = $this->zip_fd;
    $this->zip_fd = $v50;
    $v50 = $v_swap;

    // ----- Close
    $this->f6();
    $v39_to_add->f6();

    // ----- Close the temporary file
    @fclose($v50);

    // ----- Delete the zip file
    // TBC : I should test the result ...
    @unlink($this->zipname);

    // ----- Rename the temporary file
    // TBC : I should test the result ...
    //@rename($v_zip_temp_name, $this->zipname);
    c1UtilRename($v_zip_temp_name, $this->zipname);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privDuplicate()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function privDuplicate($v38)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1::privDuplicate", "archive_filename='$v38'");
    $v9=1;

    // ----- Look if the $v38 exists
    if (!is_file($v38))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");

      // ----- Nothing to duplicate, so duplicate is a success.
      $v9 = 1;

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Open the zip file
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v9=$this->privOpenFd('wb')) != 1)
    {
      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
    }

    // ----- Open the temporary file in write mode
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
    if (($v50 = @fopen($v38, 'rb')) == 0)
    {
      $this->f6();

      c1::f4(d9, 'Unable to open archive file \''.$v38.'\' in binary write mode');

      // ----- Return
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, c1::f9(), c1::errorInfo());
      return c1::f9();
    }

    // ----- Copy the files from the archive to the temporary file
    // TBC : Here I should better append the file and go back to erase the central dir
    $v8 = filesize($v38);
    while ($v8 != 0)
    {
      $v57 = ($v8 < d1 ? $v8 : d1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v57 bytes");
      $v37 = fread($v50, $v57);
      @fwrite($this->zip_fd, $v37, $v57);
      $v8 -= $v57;
    }

    // ----- Close
    $this->f6();

    // ----- Close the temporary file
    @fclose($v50);

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f4()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function f4($p_error_code=0, $p_error_string='')
  {
    if (d3 == 1) {
      PclError($p_error_code, $p_error_string);
    }
    else {
      $this->error_code = $p_error_code;
      $this->error_string = $p_error_string;
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : privErrorReset()
  // Description :
  // Parameters :
  // --------------------------------------------------------------------------------
  function privErrorReset()
  {
    if (d3 == 1) {
      PclErrorReset();
    }
    else {
      $this->error_code = 0;
      $this->error_string = '';
    }
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f14()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f14()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f14', "");
    $v9=1;

    // ----- Look if function exists
    if (   (!function_exists("get_magic_quotes_runtime"))
	    || (!function_exists("set_magic_quotes_runtime"))) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
	}

    // ----- Look if already done
    if ($this->magic_quotes_status != -1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
	}

	// ----- Get and memorize the magic_quote value
	$this->magic_quotes_status = @get_magic_quotes_runtime();
    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");

	// ----- Disable magic_quotes
	if ($this->magic_quotes_status == 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
	  @set_magic_quotes_runtime(0);
	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f8()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function f8()
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'c1::f8', "");
    $v9=1;

    // ----- Look if function exists
    if (   (!function_exists("get_magic_quotes_runtime"))
	    || (!function_exists("set_magic_quotes_runtime"))) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
	}

    // ----- Look if something to do
    if ($this->magic_quotes_status != -1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
      return $v9;
	}

	// ----- Swap back magic_quotes
	if ($this->magic_quotes_status == 1) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
  	  @set_magic_quotes_runtime($this->magic_quotes_status);
	}

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  }
  // End of class
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : c1UtilPathReduction()
  // Description :
  // Parameters :
  // Return Values :
  // --------------------------------------------------------------------------------
  function c1UtilPathReduction($p_dir)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1UtilPathReduction", "dir='$p_dir'");
    $v9 = "";

    // ----- Look for not empty path
    if ($p_dir != "") {
      // ----- Explode path by directory names
      $v24 = explode("/", $p_dir);

      // ----- Study directories from last to first
      $v_skip = 0;
      for ($o=sizeof($v24)-1; $o>=0; $o--) {
        // ----- Look for current path
        if ($v24[$o] == ".") {
          // ----- Ignore this directory
          // Should be the first $o=0, but no check is done
        }
        else if ($v24[$o] == "..") {
		  $v_skip++;
        }
        else if ($v24[$o] == "") {
		  // ----- First '/' i.e. root slash
		  if ($o == 0) {
            $v9 = "/".$v9;
		    if ($v_skip > 0) {
		        // ----- It is an invalid path, so the path is not modified
		        // TBC
		        $v9 = $p_dir;
                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
                $v_skip = 0;
		    }
		  }
		  // ----- Last '/' i.e. indicates a directory
		  else if ($o == (sizeof($v24)-1)) {
            $v9 = $v24[$o];
		  }
		  // ----- Double '/' inside the path
		  else {
            // ----- Ignore only the double '//' in path,
            // but not the first and last '/'
		  }
        }
        else {
		  // ----- Look for item to skip
		  if ($v_skip > 0) {
		    $v_skip--;
		  }
		  else {
            $v9 = $v24[$o].($o!=(sizeof($v24)-1)?"/".$v9:"");
		  }
        }
      }
      
      // ----- Look for skip
      if ($v_skip > 0) {
        while ($v_skip > 0) {
            $v9 = '../'.$v9;
            $v_skip--;
        }
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : c1UtilPathInclusion()
  // Description :
  //   This function indicates if the path $v27 is under the $p_dir tree. Or,
  //   said in an other way, if the file or sub-dir $v27 is inside the dir
  //   $p_dir.
  //   The function indicates also if the path is exactly the same as the dir.
  //   This function supports path with duplicated '/' like '//', but does not
  //   support '.' or '..' statements.
  // Parameters :
  // Return Values :
  //   0 if $v27 is not inside directory $p_dir
  //   1 if $v27 is inside directory $p_dir
  //   2 if $v27 is exactly the same as $p_dir
  // --------------------------------------------------------------------------------
  function c1UtilPathInclusion($p_dir, $v27)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1UtilPathInclusion", "dir='$p_dir', path='$v27'");
    $v9 = 1;
    
    // ----- Look for path beginning by ./
    if (   ($p_dir == '.')
        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
      $p_dir = c1UtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
    }
    if (   ($v27 == '.')
        || ((strlen($v27) >=2) && (substr($v27, 0, 2) == './'))) {
      $v27 = c1UtilTranslateWinPath(getcwd(), FALSE).'/'.substr($v27, 1);
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$v27."'");
    }

    // ----- Explode dir and path by directory separator
    $v24_dir = explode("/", $p_dir);
    $v24_dir_size = sizeof($v24_dir);
    $v24_path = explode("/", $v27);
    $v24_path_size = sizeof($v24_path);

    // ----- Study directories paths
    $o = 0;
    $h = 0;
    while (($o < $v24_dir_size) && ($h < $v24_path_size) && ($v9)) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($o)='".$v24_dir[$o]."' and path($h)='".$v24_path[$h]."'");

      // ----- Look for empty dir (path reduction)
      if ($v24_dir[$o] == '') {
        $o++;
        continue;
      }
      if ($v24_path[$h] == '') {
        $h++;
        continue;
      }

      // ----- Compare the items
      if (($v24_dir[$o] != $v24_path[$h]) && ($v24_dir[$o] != '') && ( $v24_path[$h] != ''))  {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($o,$h) are different");
        $v9 = 0;
      }

      // ----- Next items
      $o++;
      $h++;
    }

    // ----- Look if everything seems to be the same
    if ($v9) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
      // ----- Skip all the empty items
      while (($h < $v24_path_size) && ($v24_path[$h] == '')) $h++;
      while (($o < $v24_dir_size) && ($v24_dir[$o] == '')) $o++;
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($o)='".($o < $v24_dir_size?$v24_dir[$o]:'')."' and path($h)='".($h < $v24_path_size?$v24_path[$h]:'')."'");

      if (($o >= $v24_dir_size) && ($h >= $v24_path_size)) {
        // ----- There are exactly the same
        $v9 = 2;
      }
      else if ($o < $v24_dir_size) {
        // ----- The path is shorter than the dir
        $v9 = 0;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : c1UtilCopyBlock()
  // Description :
  // Parameters :
  //   $p_mode : read/write compression mode
  //             0 : src & dest normal
  //             1 : src gzip, dest normal
  //             2 : src normal, dest gzip
  //             3 : src & dest gzip
  // Return Values :
  // --------------------------------------------------------------------------------
  function c1UtilCopyBlock($p_src, $p_dest, $v44, $p_mode=0)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1UtilCopyBlock", "size=$v44, mode=$p_mode");
    $v9 = 1;

    if ($p_mode==0)
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
      while ($v44 != 0)
      {
        $v57 = ($v44 < d1 ? $v44 : d1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
        $v37 = @fread($p_src, $v57);
        @fwrite($p_dest, $v37, $v57);
        $v44 -= $v57;
      }
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
    }
    else if ($p_mode==1)
    {
      while ($v44 != 0)
      {
        $v57 = ($v44 < d1 ? $v44 : d1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
        $v37 = @gzread($p_src, $v57);
        @fwrite($p_dest, $v37, $v57);
        $v44 -= $v57;
      }
    }
    else if ($p_mode==2)
    {
      while ($v44 != 0)
      {
        $v57 = ($v44 < d1 ? $v44 : d1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
        $v37 = @fread($p_src, $v57);
        @gzwrite($p_dest, $v37, $v57);
        $v44 -= $v57;
      }
    }
    else if ($p_mode==3)
    {
      while ($v44 != 0)
      {
        $v57 = ($v44 < d1 ? $v44 : d1);
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v57 bytes");
        $v37 = @gzread($p_src, $v57);
        @gzwrite($p_dest, $v37, $v57);
        $v44 -= $v57;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : c1UtilRename()
  // Description :
  //   This function tries to do a simple rename() function. If it fails, it
  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
  //   first one.
  // Parameters :
  //   $p_src : Old filename
  //   $p_dest : New filename
  // Return Values :
  //   1 on success, 0 on failure.
  // --------------------------------------------------------------------------------
  function c1UtilRename($p_src, $p_dest)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "c1UtilRename", "source=$p_src, destination=$p_dest");
    $v9 = 1;

    // ----- Try to rename the files
    if (!@rename($p_src, $p_dest)) {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");

      // ----- Try to copy & unlink the src
      if (!@copy($p_src, $p_dest)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
        $v9 = 0;
      }
      else if (!@unlink($p_src)) {
        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
        $v9 = 0;
      }
    }

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : f13()
  // Description :
  //   Translate option value in text. Mainly for debug purpose.
  // Parameters :
  //   $v65 : the option value.
  // Return Values :
  //   The option text value.
  // --------------------------------------------------------------------------------
  function f13($v65)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "f13", "option='".$v65."'");
    
    $v24 = get_defined_constants();
    for (reset($v24); $v_key = key($v24); next($v24)) {
	    $v_prefix = substr($v_key, 0, 10);
	    if ((   ($v_prefix == 'c1_OPT')
           || ($v_prefix == 'c1_CB_')
           || ($v_prefix == 'c1_ATT'))
	        && ($v24[$v_key] == $v65)) {
        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
        return $v_key;
	    }
    }
    
    $v9 = 'Unknown';

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v9);
    return $v9;
  }
  // --------------------------------------------------------------------------------

  // --------------------------------------------------------------------------------
  // Function : c1UtilTranslateWinPath()
  // Description :
  //   Translate windows path by replacing '\' by '/' and optionally removing
  //   drive letter.
  // Parameters :
  //   $v27 : path to translate.
  //   $v54 : true | false
  // Return Values :
  //   The path translated.
  // --------------------------------------------------------------------------------
  function c1UtilTranslateWinPath($v27, $v54=true)
  {
    if (stristr(php_uname(), 'windows')) {
      // ----- Look for potential disk letter
      if (($v54) && (($v32ition = strpos($v27, ':')) != false)) {
          $v27 = substr($v27, $v32ition+1);
      }
      // ----- Change potential windows directory separator
      if ((strpos($v27, '\\') > 0) || (substr($v27, 0,1) == '\\')) {
          $v27 = strtr($v27, '\\', '/');
      }
    }
    return $v27;
  }
  // --------------------------------------------------------------------------------


?>
